How to use workit-core - 10 common examples

To help you get started, we’ve selected a few workit-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VilledeMontreal / workit / packages / workit-camunda / sample / create-process-instances.ts View on Github external
(async () => {
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm); // TAG.zeebe
    for (let index = 0; index < 1; index++) {
        await cm.createWorkflowInstance({
            bpmnProcessId: "BPMN_DEMO",
            variables: {
                amount: 1000,
                hello: "world"
            }
        });
    }
    // tslint:disable-next-line: no-console
    console.log('Success!');
})();
github VilledeMontreal / workit / packages / workit-camunda / sample / worker.1.ts View on Github external
(async () => {
    enum LOCAL_IDENTIFIER {
        sample_activity = 'sample_activity'
    }


    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.sample_activity);

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    const path = `${ process.cwd() }/sample/BPMN_DEMO.bpmn`;
    await cm.deployWorkflow(path);

    // await cm.updateVariables({ 
    //     processInstanceId: "5c50c48e-4691-11e9-8b8f-0242ac110002",
    //     variables: { amount: 1000 }
    // });

    worker.start();

    worker.run().catch((e) => console.log(e));
    console.log('stop worker');
    await worker.stop();
    console.log('rerun worker');
    worker.run().catch((e) => console.log(e));
github VilledeMontreal / workit / packages / workit-camunda / sample / worker.1.ts View on Github external
(async () => {
    enum LOCAL_IDENTIFIER {
        sample_activity = 'sample_activity'
    }


    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.sample_activity);

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    const path = `${ process.cwd() }/sample/BPMN_DEMO.bpmn`;
    await cm.deployWorkflow(path);

    // await cm.updateVariables({ 
    //     processInstanceId: "5c50c48e-4691-11e9-8b8f-0242ac110002",
    //     variables: { amount: 1000 }
    // });

    worker.start();

    worker.run().catch((e) => console.log(e));
    console.log('stop worker');
    await worker.stop();
    console.log('rerun worker');
github VilledeMontreal / workit / packages / workit-camunda / sample / complex_binding.ts View on Github external
(async () => {
    enum LOCAL_IDENTIFIER {
        activity1 = 'activity_1',
        activity2 = 'activity_2',
        activity3 = 'activity_3'
    }

    const BPMN_PROCESS_ID = "BPMN_P_DEMO";

    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity1);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity2);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity3);

    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });

    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    // const path = `${process.cwd()}/sample/BPMN_P_DEMO.bpmn`;
    // await cm.deployWorkflow(path);
    for (let index = 0; index < 1; index++) {
github VilledeMontreal / workit / packages / workit-camunda / sample / message-event.ts View on Github external
(async () => {
    enum LOCAL_IDENTIFIER {
        sample_activity = 'sample_activity'
    }

    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.sample_activity);

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    const path = `${ process.cwd() }/sample/MESSAGE_EVENT.bpmn`;
    await cm.deployWorkflow(path);
    await cm.publishMessage({
        correlation: {},
        name: "__MESSAGE_START_EVENT__",
        variables: { amount: 1000 },
        timeToLive: undefined,
        messageId: undefined
    });

    await cm.updateJobRetries({ jobKey: "975e1f79-518c-11e9-bd78-0242ac110003", retries: 0 });
    // setTimeout((resp) => {
github VilledeMontreal / workit / packages / workit-camunda / sample / complex_binding.ts View on Github external
const BPMN_PROCESS_ID = "BPMN_P_DEMO";

    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity1);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity2);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity3);

    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });

    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    // const path = `${process.cwd()}/sample/BPMN_P_DEMO.bpmn`;
    // await cm.deployWorkflow(path);
    for (let index = 0; index < 1; index++) {
        await cm.createWorkflowInstance({
            bpmnProcessId: BPMN_PROCESS_ID,
            variables: {
                amount: 1000,
                hello: "world"
            }
        });
    }

    worker.start();
    worker.run();
github VilledeMontreal / workit / packages / workit-camunda / sample / message-event.ts View on Github external
(async () => {
    enum LOCAL_IDENTIFIER {
        sample_activity = 'sample_activity'
    }

    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.sample_activity);

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    const path = `${ process.cwd() }/sample/MESSAGE_EVENT.bpmn`;
    await cm.deployWorkflow(path);
    await cm.publishMessage({
        correlation: {},
        name: "__MESSAGE_START_EVENT__",
        variables: { amount: 1000 },
        timeToLive: undefined,
        messageId: undefined
    });

    await cm.updateJobRetries({ jobKey: "975e1f79-518c-11e9-bd78-0242ac110003", retries: 0 });
    // setTimeout((resp) => {
    //     cm.publishMessage({
    //         correlation: {},
github VilledeMontreal / workit / packages / workit-camunda / sample / complex_binding.ts View on Github external
const BPMN_PROCESS_ID = "BPMN_P_DEMO";

    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity1);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity2);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity3);

    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });

    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    // const path = `${process.cwd()}/sample/BPMN_P_DEMO.bpmn`;
    // await cm.deployWorkflow(path);
    for (let index = 0; index < 1; index++) {
        await cm.createWorkflowInstance({
            bpmnProcessId: BPMN_PROCESS_ID,
            variables: {
                amount: 1000,
                hello: "world"
            }
        });
    }

    worker.start();
    worker.run();
github VilledeMontreal / workit / packages / workit-camunda / sample / parallel.ts View on Github external
IoC.bindToObject(tracerService.getTracer(), CORE_IDENTIFIER.tracer);

    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity1);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity2);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity3);

    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });

    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    const path = `${ process.cwd() }/sample/BPMN_P_DEMO.bpmn`;
    await cm.deployWorkflow(path);
    for (let index = 0; index < 1; index++) {
        await cm.createWorkflowInstance({
            bpmnProcessId: BPMN_PROCESS_ID,
            variables: {
                amount: 1000,
                hello: "world",
                // requestInfo: {
                //     'vdm-trace-id': 'f78b0a8858ce337a:f78b0a8858ce337a:0:1',
                // }
            }
        });
    }
github VilledeMontreal / workit / packages / workit-camunda / sample / complex_binding.ts View on Github external
activity3 = 'activity_3'
    }

    const BPMN_PROCESS_ID = "BPMN_P_DEMO";

    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity1);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity2);
    IoC.bindTo(HelloWorldTask, LOCAL_IDENTIFIER.activity3);

    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });
    IoC.bindTask(HelloWorldTaskV2, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 2 });

    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity1, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity2, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });
    IoC.bindTask(HelloWorldTaskV3, LOCAL_IDENTIFIER.activity3, { bpmnProcessId: BPMN_PROCESS_ID, version: 3 });

    const worker = IoC.get(CORE_IDENTIFIER.worker, TAG.camundaBpm);
    const cm = IoC.get(CORE_IDENTIFIER.client_manager, TAG.camundaBpm);

    // const path = `${process.cwd()}/sample/BPMN_P_DEMO.bpmn`;
    // await cm.deployWorkflow(path);
    for (let index = 0; index < 1; index++) {
        await cm.createWorkflowInstance({
            bpmnProcessId: BPMN_PROCESS_ID,
            variables: {
                amount: 1000,
                hello: "world"
            }
        });
    }