Class: OpenWFE::ProcessParticipant
- Inherits:
-
Object
- Object
- OpenWFE::ProcessParticipant
- Includes:
- LocalParticipant
- Defined in:
- lib/openwfe/participants/participants.rb
Overview
Links a process under a participant [name].
Turns top level processes into participants
Some examples :
require 'engine/participants/participants'
engine.register_participant(
"transmit_to_accounting",
"http://company.process.server.ie/processes/acc0.xml")
engine.register_participant(
"hr_resume_review_process",
"file:/var/processes/hr_resume_review_process.rb")
Some more examples :
class RegistrationProcess < OpenWFE::ProcessDefinition
sequence do
participant :ref => "Alice"
participant :ref => "Bob"
end
end
# later in the code ...
engine.register_participant("registration", RegistrationProcess)
Or directly with some XML string :
engine.register_participant("registration", '''
<process-definition name="registration" revision="0.1">
<sequence>
<participant ref="Alice" />
<participant ref="Bob" />
</sequence>
</process-definition>
'''.strip)
It’s then easy to call the subprocess as if it were a participant :
sequence do
participant :ref => "registration"
# or
participant "registration"
# or simply
registration
end
Note that the ‘subprocess’ expression may be used as well :
sequence do
subprocess ref => "http://dms.company.org/processes/proc1.rb"
end
But you can’t use the URL as an expression name for writing nice, concise, process definitions.
Instance Attribute Summary
Attributes included from Contextual
Instance Method Summary collapse
-
#consume(workitem) ⇒ Object
This is the method called by the engine when it has a workitem for this participant.
-
#initialize(object) ⇒ ProcessParticipant
constructor
The ‘object’ may be the URL of a process definition or the process definition itself as an XML string or a Ruby process definition (as a class or in a String).
Methods included from LocalParticipant
#call_block, #get_flow_expression, #reply_to_engine
Methods included from Contextual
#get_work_directory, #init_service, #lookup
Methods included from Logging
#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn
Methods included from OwfeServiceLocator
#get_engine, #get_error_journal, #get_expool, #get_expression_map, #get_expression_pool, #get_expression_storage, #get_expression_storages, #get_journal, #get_participant_map, #get_scheduler, #get_wfid_generator
Constructor Details
#initialize(object) ⇒ ProcessParticipant
The ‘object’ may be the URL of a process definition or the process definition itself as an XML string or a Ruby process definition (as a class or in a String).
336 337 338 339 340 341 342 343 |
# File 'lib/openwfe/participants/participants.rb', line 336 def initialize (object) super() template_uri = OpenWFE::parse_known_uri object @template = template_uri || object end |
Instance Method Details
#consume(workitem) ⇒ Object
This is the method called by the engine when it has a workitem for this participant.
349 350 351 352 353 354 355 356 357 358 |
# File 'lib/openwfe/participants/participants.rb', line 349 def consume (workitem) get_expression_pool.launch_template( get_flow_expression(workitem), nil, # new environment 0, # sub_id @template, workitem) #params) end |