Module | Ruote::ReceiverMixin |
In: |
lib/ruote/receiver/base.rb
|
The core methods for the Receiver class (sometimes a Mixin is easier to integrate).
(The dashboard itself includes this mixin, the LocalParticipant module includes it as well).
Convenience method, given a workitem or a fei, returns the corresponding flow expession.
A convenience methods for advanced users (like Oleg).
Given a fei (flow expression id), fetches the workitem as stored in the expression with that fei. This is the "applied workitem", if the workitem is currently handed to a participant, this method will return the workitem as applied, not the workitem as saved by the participant/user in whatever worklist it uses. If you need that workitem, do the vanilla thing and ask it to the [storage] participant or its worklist.
The fei might be a string fei (result of fei.to_storage_id), a FlowExpressionId instance or a hash.
on_terminate processes are not triggered for on_error processes. on_error processes are triggered for on_terminate processes as well.
Can be used to raise an error in the workflow instance.
Can be called either with an error class and arguments, either with an error instance (and no arguments).
The workitem can be either an instance of Ruote::Workitem or a workitem in its Hash representation.
receiver.flunk(workitem, ArgumentError, "not enough info") rescue => e receiver.flunk(workitem, e) end
Given a process definitions and optional initial fields and variables, launches a new process instance.
This method is mostly used from the Ruote::Dashboard class (which includes this mixin).
process_definition must be a result of Ruote.process_definition call or XML or JSON serialized process definition, as accepted by Ruote::Reader#read.
fields are workflow parameters that will be placed in workitem.fields.
Calls to this method returns the newly launched "workflow instance id" ("wfid" for short), the [hopefully] unique identifier for the process instance.
When calling this method, it‘s OK to pass a field named :wfid (Symbol, not String) that will be used as the identifier for the process instance.
This method pipes back a workitem into the engine, letting it resume in its flow, hopefully.
Stashes values in the participant expression (in the storage).
put(workitem.fei, 'key' => 'value', 'colour' => 'blue')
Remember that keys/values must be serializable in JSON.
put & get are useful for a participant that needs to communicate between its consume and its cancel.
See the thread at groups.google.com/group/openwferu-users/t/2e6a95708c10847b for the justification.