Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2011 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1063110 to your computer and use it in GitHub Desktop.
Save anonymous/1063110 to your computer and use it in GitHub Desktop.
Test on the :union option for concurrent participant.
#!/usr/bin/env ruby
require 'pp'
require 'ruote'
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new()))
#engine.noisy = true
engine.register_participant :alpha do |workitem|
workitem.fields['choses'] = { 'truc' => 'bidule', 'machin' => 'chose'}
end
engine.register_participant :beta do |workitem|
workitem.fields['choses'] = { 'curt' => 'eludib', 'nicham' => 'esoch'}
end
engine.register_participant :delta do |workitem|
pp workitem
end
proc = Ruote.process_definition do |workitem|
sequence do
concurrence :merge_type => :union do
participant :beta
participant :alpha
end
participant :delta
end
end
id = engine.launch(proc)
engine.wait_for(id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment