Shared activity behaviour.
All activities except EventBasedGateway share this lifecycle. The EventBasedGateway takes care of it's own outbound in the Behaviour.
Arguments:
Behaviour
: activity Behaviour function, called with newactivityDefinition
: activity definition object from serializable contextcontext
: shared context
Activity properties:
id
: activity idtype
: activity typename
: activity nameattachedTo
: activity is attached to, e.g. a BoundaryEventBehaviour
: passed activity Behaviour function, invoked with newbehaviour
: activity behaviour from serializable contextbroker
: activity brokercounters
: counters for completed runs etcenvironment
: shared environmentexecution
: getter for current execution instanceexecutionId
: current unique execution idextensions
: object with extensionsinbound
: list of inbound sequence flowsisRunning
: boolean indicating if the activity is runningisStart
: boolean indicating if the activity a start activityisSubProcess
: boolean indicating if the activity is a sub processlogger
: activity logger instanceoutbound
: list of outbound sequence flowsparent
: activity parentid
: id of parenttype
: parent type
parentElement
: activity parent process or sub process referencelane
: activity lane reference if anystatus
: current run statusentered
: Run entered, triggered by taken inbound flowstarted
: Run startedexecuting
: Executing activity behaviourexecuted
: Activity behaviour execution completed successfullyend
: Run end, take outbound flowsdiscard
: Entering discard run, triggered by discarded inbound flowdiscarded
: Run was discarded, discard outbound flowserror
: Activity behaviour execution failed, discard runformatting
: Formatting next run message
stopped
: boolean indicating if the activity is in a stopped state
Start listening on inbound sequence flow(s) events.
Stop listening for inbound sequence flow(s) events.
Discard activity. If the activity is running - discard run.
Get activity api.
Arguments:
message
: activity broker message
Returns activity api
Get activity by id from context.
Get activity state. If environment.settings.disableTrackState === true
the state may be undefined if the task is not running.
Send message to activity. Queues message to activity.
Take next message in run-queue. Only appears if environment settings have step: true
.
Listen for events.
Arguments:
eventName
: name of eventhandler
: required function called when events occurapi
: activity api
eventOptions
: passed to underlying broker as consume options
Listen for event.
Arguments:
eventName
: name of eventhandler
: required function called when event occurapi
: activity api
eventOptions
: passed to underlying broker as consume options
Recover activity from state.
Resume recovered or stopped activity.
Run activity.
Arguments:
runContent
: optional object containing extra content for the broker run messages.
Stop activity 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 arguments:routingKey
: broker message routing keymessage
: actual message that match event nameowner
: message owner, in this case probably the actual activity instance
Returns Promise that will resolve with activity api on event name or reject on error.
Evaluate all outbound sequence flows.
Arguments:
brokerMessage
: broker message that will be passed to conditiondiscardRestAtTake
: boolean, discard all other outbound flows if one flow is takencallback
: function with signature,(err, outbound)
err
: occasional erroroutbound
: list with flow actions, i.e. discard or takeid
: outbound flow idaction
: discard or take as stringisDefault
: boolean indicating if flow is default flowresult
: result of conditionmessage
: optional message passed from argumentbrokerMessage.content.message