On Thu, Feb 18, 2010 at 6:27 AM, Dave @ UPENN <[email protected]> wrote:
>
> so i'm having a little trouble with passing vars among participants
> when using concurrence.
>
> (...)
>
> what's the
> best way to pass the live output info from a few concurrent
> participants to successive participants downstream?

Hello Dave,

have you tried to use the :merge_type => :isolate attribute of the
concurrence (or concurrent-iterator) expression ?

Gist at : http://gist.github.com/307172

---8<---
require 'rubygems'
require 'ruote'

engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new()))
  # for this example we use a transient, in-memory engine

#engine.context.logger.noisy = true
  # useful when debugging

engine.register_participant 'summary' do |workitem|

  puts '... summary :'
  i = 0
  while (v = workitem.fields[i.to_s])
    puts " - #{v['result']}"
    i = i + 1
  end
end

engine.register_participant '.+' do |workitem|

  workitem.fields['result'] = "#{workitem.participant_name} : #{rand}"
end

pdef = Ruote.process_definition :name => 'test' do
  sequence do
    concurrence :merge_type => :isolate do
      alpha
      bravo
      charly
    end
    summary
  end
end

wfid = engine.launch(pdef)
engine.wait_for(wfid)
--->8---

More information at :

  http://ruote.rubyforge.org/exp/concurrence.html
  http://ruote.rubyforge.org/exp/concurrent_iterator.html

If you have suggestions/ideas/critics for this aspect of concurrence,
they are welcome.


Best regards,

-- 
John Mettraux   -   http://jmettraux.wordpress.com

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to