8.2.2 • Published 8 months ago

neo-bpmn-engine v8.2.2

Weekly downloads
132
License
MIT
Repository
-
Last release
8 months ago

Neo BPMN Engine in Javascript

Yet another Javascript-based BPMN engine, still under active development, any bug report, issues or questions are welcome, please refer to the Contribution Guidelines section.

Quick Start

npm install neo-bpmn-engine

The engine is designed to be embeddable in any application executing in a javascript environment, browser or NodeJS and provides the absolute minimum interface for execution of the given BPMN XML, starting/stopping process instances and monitoring the same. Additionally, the application could extend the engine for domain specific applications by implementing custom serviceTask, messages, signals and script tasks. A thin wrapper could also be written to expose the engine via HTTP or any other transport, in addition to implementation of common enterprise functions such as authorization.

The two core classes of the engine are BpmnProcess, which serves as a template for creating process instances and the process instance represented by the BpmnProcessInstance class. A BPMNProcess must be created from a valid, executable BPMN XML string, given below.

import * as Engine from 'neo-bpmn-engine';

const myBpmnProcess = await Engine.BpmnProcess.fromXml('process-id', '<...bpmn-process-xml...>');

The above step creates a BPMN process, ready for deployment. Deployment is an essential step, which tells the BpmnProcess class that any auto-triggered start events such as timers may start new instances and message/start start events may wait for invocation. Before starting a process instance, it is essential that we register a callback that will be notified on each creation of a new process instance.

myBpmnProcess.getInstance$().subscribe(newInstance => {
  console.log('--> A new instance was created', newInstance.getId());
});

The above block prepares a callback that will print the id of the newly created process instance. getInstance$ returns a stream of instances, errors in creation of a new instance can also be handled in the same subscription as follows:

myBpmnProcess.getInstance$().subscribe({
  next: instance => {
    console.log('--> A new instance was created', newInstance.getId());
  },
  error: error => {
    console.log('--> Error on instance creation', error);
  }
});
myBpmnProcess.getInstance$().subscribe(newInstance => {
  newInstance.getLog$().subscribe((l) => console.log('%s %s %s - %s %o', l.timestamp, getLevelName(l.level), l.name, l.message, l.params);)
});

Every processinstance has an own logstream which can be subscribed to via the function getLog$

After setting up the subscription, its time to create instances:

myBpmnProcess.deployAndStart();

The above code will deploy the xml and start an instance at a none start event, schedule any timer start events and also wait for message/signal start events. If starting at a specific element is desired,

myBpmnProcess.deployAndStartAt({ id: 'Task_sdf82n' });

Optionally, the process can be started with an initial set of variables,

myBpmnProcess.deployAndStart({ variables: { a: 10, b: 20 } });

Subscription to getInstance$() is not the only way to obtain references to the instances. You can get an array of all the instances via getAllInstances() and if the instance id is known already, you can use getInstanceById(id) on the objects of the BpmnProcess class.

Documentation

BPMN Coverage Status

The engine covers the following BPMN elements:

ElementStatusNotesTests
Sequence Flow:white_check_mark:Supports condition expression evaluation in JSTest cases
Message Flow
Data Association
Exclusive Gateway:white_check_mark:Test cases
Parallel Gateway:white_check_mark:Test cases
Event-Based Gateway:white_check_mark:with intermediate catch events from belowTest cases
Inclusive Gateway:white_check_mark:With limitations, refer Known Issues and LimitationsTest cases
User Task:white_check_mark:Test cases
Service Task
Script Task:white_check_mark:Test cases
Receive Task
Sub Process:white_check_mark:Test cases
Call Activity:white_check_mark:Test cases
Pool
Lane
Data Object
Data Store
None Start Event:white_check_mark:Test cases
Message Start Event:white_check_mark:Test cases
Signal Start Event:white_check_mark:Test cases
Timer Start Event:white_check_mark:cycle and date support pendingTest cases
None End Event:white_check_mark:Test cases
Message End Event:white_check_mark:Test cases
Signal End Event:white_check_mark:Test cases
Terminate End Event:white_check_mark:Test cases
Intermediate Catch Event (Message):white_check_mark:message vars pendingTest cases
Intermediate Catch Event (Signal):white_check_mark:Test cases
Intermediate Catch Event (Timer):white_check_mark:cycle and date support pendingTest cases
Intermediate Throw Event (Message):white_check_mark:Test cases
Intermediate Throw Event (Signal):white_check_mark:Test cases
Error Boundary Event:white_check_mark:Test cases
Escalation Boundary Event:white_check_mark:Test cases
Timer Boundary Event:white_check_mark:Test cases
Loop
Multi Instance

Known Issues and Limitations

  • Handling Gateways: several corner cases related to gateways, described in Russell, 2006 require heavy processing and are not required to be implemented if the bpmn is structured (splits and merges are balanced). Therefore, at this moment we do not implement WCP-38.

  • Ambiguity in instance start: the BPMN specification provides several ways of creating a new process instance via start events OMG, 2014, however, the execution semantics specifies the usage of the same start events to reuse instances, we do not support this as of now.

8.2.2

8 months ago

8.1.0

10 months ago

8.2.1

9 months ago

8.2.0

9 months ago

7.0.0

1 year ago

7.0.2

1 year ago

7.0.1

1 year ago

6.4.0

1 year ago

8.0.1

1 year ago

8.0.0

1 year ago

6.1.0

1 year ago

6.2.0

1 year ago

6.3.0

1 year ago

6.3.2

1 year ago

6.3.1

1 year ago

5.0.0

2 years ago

5.1.2

2 years ago

5.1.1

2 years ago

5.1.0

2 years ago

6.0.0

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

4.0.0

2 years ago

3.5.0

2 years ago

3.3.1

2 years ago

4.1.0

2 years ago

4.1.2

2 years ago

2.0.5

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

3.1.0

2 years ago

2.0.3

2 years ago

2.0.4

2 years ago

2.0.2

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.11

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.13.6

4 years ago

0.13.5

4 years ago

0.13.4

4 years ago

0.13.3

4 years ago

0.13.2

4 years ago

0.13.1

4 years ago

0.13.0

4 years ago

0.12.8

4 years ago

0.12.9

4 years ago

0.12.7

4 years ago

0.12.6

4 years ago

0.12.5

4 years ago

0.12.4

4 years ago

0.12.3

4 years ago

0.12.2

4 years ago

0.12.1

4 years ago

0.12.0

4 years ago

0.11.9

4 years ago

0.11.8

4 years ago

0.11.7

4 years ago

0.11.6

4 years ago

0.11.5

4 years ago

0.11.4

4 years ago

0.11.3

4 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.5

4 years ago

0.10.8

4 years ago

0.10.4

4 years ago

0.10.3

4 years ago

0.10.2

4 years ago

0.10.1

4 years ago

0.9.3

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago