How to use the API to control tokens in bpmn-js-token-simulation

Our project is ready to add a breakpoint debugging feature for the process, I saw bpmn-js-token-simulation this project, I don’t know if it can meet our needs.

Before debugging, breakpoint some nodes, then enter run parameters and the backend service starts the process. Where the process runs to, and on which node the token is, is told to the front-end by the back-end service. For example, when a gateway is encountered, the sequenceFlow conditionExpression backend executes the expression and tells the frontend which Flow to go.

I’m not sure if there is currently an API for this:

  1. create a token that can specify that the token flows from node A to node B (with no other nodes in between)?
  2. support waiting for the token to enter and exit the node when a breakpoint is encountered (simulationSupport.elementEnter, simulationSupport.elementExit could fulfill our needs)
  3. the token may not start at the startEvent node, e.g. if there is a callActivity node in the flow, the token flows from the callActivity node to the next node after entering the calledElement flow out.

Can you tell me which APIs to use or how to do it?

Best regards !

I don’t think token simulation is what you need:

  • It is a simulator / engine on its own.
  • It offers UI controls (on top). This is what you’d want to re-use

In theory, of course you could replace Simulator completely to trigger external changes in your remote system. I believe it would be a lot of work though, and we don’t guarantee that the APIs used are stable across future major releases.

As an experiment checkout SimulatorSpec and see if you’d want to implement a similar API surface.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.