@villedemontreal/workit-zeebe-client

Zeebe client for WorkIt that works with Zeebe platform powered by TypeScript

Usage no npm install needed!

<script type="module">
  import villedemontrealWorkitZeebeClient from 'https://cdn.skypack.dev/@villedemontreal/workit-zeebe-client';
</script>

README

WorkIt Zeebe Client

License: MIT

Installing

npm i workit-zeebe-client

How to use

    const config = {
      maxTasks: 32,
      workerId: 'test-worker',
      baseUrl: `localhost:26500`,
      topicName: 'demo-service',
      bpmnKey: 'BPMN_DEMO'
    };

    const client = new ZeebeClient(config);
    
    await client.deployWorkflow('deploy-your.bpmn');
    await client.createWorkflowInstance({
        bpmnProcessId: "BPMN_DEMO",
        variables: {
            amount: 1000,
            hello: "world"
        }
    });
    await client.subscribe(async (message, service) => {
      // do something
    });

Start a worker

    import { NoopTracer } from '@opentelemetry/api/build/src/trace/NoopTracer';
    import { FailureStrategySimple, SCProcessHandler, SuccessStrategySimple, Worker } from '@villedemontreal/workit-core';

    const client = new ZeebeClient(config);
    const successHandler = new SuccessStrategySimple();
    const failureHandler = new FailureStrategySimple();
    const processHandler = new SCProcessHandler(successHandler, failureHandler, new NoopTracer());
    const worker = new Worker(client, processHandler);

    worker.start();
    worker.run();

Useful links

Maintainers

See the list of contributors who participated in this project.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE file for details