Class OpenWFE::ProcessParticipant

  1. 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.

Methods

public class

  1. new

public instance

  1. consume

Included modules

  1. LocalParticipant

Public class methods

new (object)

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).

[show source]
     # File lib/openwfe/participants/participants.rb, line 317
317:     def initialize (object)
318: 
319:       super()
320: 
321:       template_uri = OpenWFE::parse_known_uri(object)
322: 
323:       @template = template_uri || object
324:     end

Public instance methods

consume (workitem)

This is the method called by the engine when it has a workitem for this participant.

[show source]
     # File lib/openwfe/participants/participants.rb, line 330
330:     def consume (workitem)
331: 
332:       get_expression_pool.launch_subprocess(
333:         get_flow_expression(workitem),
334:         @template,
335:         false, # don't forget
336:         workitem,
337:         nil) # no params for the new subprocess env
338:     end