| Class | OpenWFE::ProcessParticipant |
| In: |
lib/openwfe/participants/participants.rb
|
| Parent: | Object |
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.
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).
# File lib/openwfe/participants/participants.rb, line 336
336: def initialize (object)
337:
338: super()
339:
340: template_uri = OpenWFE::parse_known_uri object
341:
342: @template = template_uri || object
343: end
This is the method called by the engine when it has a workitem for this participant.
# File lib/openwfe/participants/participants.rb, line 349
349: def consume (workitem)
350:
351: get_expression_pool.launch_template(
352: get_flow_expression(workitem),
353: nil, # new environment
354: 0, # sub_id
355: @template,
356: workitem)
357: #params)
358: end