new Process(processDefinition, context)getApi(message)getActivities()getActivityById(id)getLaneById(id)getSequenceFlows()getStartActivities([filterOptions])getPostponed()getState()init([useAsExecutionId])shake([startId])signal(message)cancelActivity(message)sendMessage(message)on(eventName, handler[, eventOptions])once(eventName, handler[, eventOptions])recover([state])resume()run()stop()waitFor(eventName[, onMessage])
Arguments:
processDefinition: process definition object from serializable contextcontext: shared context
Process properties:
id: process idtype: process typename: process nameisExecutable: boolean indicating that the process is executablebroker: process brokercontext: passed shared contextcounters: counters for completed runs etcenvironment: shared environmentexecution: getter for current execution instanceexecutionId: current unique execution idisRunning: boolean indicating if the process is runninglogger: process logger instanceparent: process parentid: id of parenttype: parent type
status: current statusstopped: boolean indicating if the process is in a stopped statelanes: list of process Lane instances
Get process or activity api.
Arguments:
message: process or activity broker message
Returns api.
Get all process activity instances.
Get activity instance by id.
Get process swim lane by id.
Get all process sequences flows.
Get start activities, optionally filtered by referenced event definition.
Arguments:
filterOptions: optional filterreferenceId: optional reference id (e.g. message or signal id)referenceType: optional reference type, e.g.'message'or'signal'
Get all activities that are in a postponed state, e.g. waiting for user input.
Get process state.
Allocate an execution id and emit process.init event without starting the run.
Arguments:
useAsExecutionId: optional override for the generated execution id
Walk the activity graph from the given start id, or every start activity when omitted.
Delegate a signal message to interested activities, e.g. SignalEventDefinition, SignalTask, ReceiveTask.
Delegate a cancel message to interested activities.
Deliver a message to a target activity or to a start activity that references it. Starts the process if a target is found and the process is idle.
Listen for events.
Arguments:
eventName: name of eventhandler: required function called when events occurapi: activity or process api
eventOptions: passed to underlying broker as consume options
Listen for event.
Arguments:
eventName: name of eventhandler: required function called when event occurapi: activity or process api
eventOptions: passed to underlying broker as consume options
Recover process from state.
Returns process.
Resume process from a stopped or recovered state.
Returns process.
Run process.
Stop process run.
Wait for event to occur as promised.
Arguments:
eventName: name of eventonMessage: optional message callback for event filtering purposes. Return false if the promise should not resolve. Called with the following argumentsroutingKey: broker message routing keymessage: actual message that match event nameowner: broker owner, in this case probably the actual activity
Returns Promise that will resolve with element api on event name or reject on error.