@villedemontreal/workit-bpm-client
TypeScript icon, indicating that this package has built-in type declarations

6.0.6-dev • Public • Published

WorkIt Camunda BPM Client

License: MIT

Installing

npm i workit-bpm-client

How to use

    import { BasicAuthInterceptor, Client as CamundaExternalClient } from 'camunda-external-task-client-js';
    
    const basicOauth = { username: 'admin', password: 'admin123' };

    const config = {
      maxTasks: 32,
      workerId: 'demo',
      baseUrl: `http://localhost:8080/engine-rest`,
      topicName: 'topic_demo',
      bpmnKey: 'BPMN_DEMO',
      autoPoll: false,
      interceptors: [new BasicAuthInterceptor(basicOauth)]
    };

    const clientLib: ICamundaClient = new CamundaExternalClient(config);
    const client = new CamundaBpmClient(config, clientLib);
    
    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
    });
    
    // client contains other useful methods

Start a worker

    import { NodeTracer } from '@opentelemetry/node';
    import { BasicAuthInterceptor, Client as CamundaExternalClient } from 'camunda-external-task-client-js';
    import { FailureStrategySimple, SCProcessHandler, SuccessStrategySimple, Worker } from '@villedemontreal/workit-core';

    const clientLib: ICamundaClient = new CamundaExternalClient(config);
    const client = new CamundaBpmClient(config, clientLib);
    const successHandler = new SuccessStrategySimple();
    const failureHandler = new FailureStrategySimple();
    const tracer = new NodeTracer();
    const processHandler = new SCProcessHandler(successHandler, failureHandler, tracer);
    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

Package Sidebar

Install

npm i @villedemontreal/workit-bpm-client

Weekly Downloads

136

Version

6.0.6-dev

License

MIT

Unpacked Size

52.4 kB

Total Files

29

Last publish

Collaborators

  • electrotype
  • psionikangel
  • olivieralbertini
  • sdriton
  • joscelynjean
  • steph-lebl
  • livetocode