On Wed, Feb 23, 2011 at 10:19:36AM -0800, Nando Sola wrote:
>
> It's been quite a long time since my last post. Nevertheless, our
> migration to ruote-kit from ruote-rest has been quite successful and
> right now we are coding new workflows.
Hello Nando,
excellent !
> I'm trying to implement a process definition that fires and forgets
> subprocesses, while the main branch continues. After reading the docs,
> I've come up with the following:
>
> --8--
> Ruote.process_definition :name => 'lousy example', :revision => '0.1'
> do
> concurrence do
> listen :to => 'foxtrot', :upon =>'reply', :wfid => true do
> sequence :forget => true do
> bravo
> subprocess :ref => 'foo'
> tango
> end
> end
> sequence do
> foxtrot
> delta
> end
> end
>
> define 'foo' do
> papa
> hotel
> end
> end
> --8--
>
> (...)
I could reproduce your issue with
---8<---
require 'rubygems'
require 'ruote'
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new))
pdef = Ruote.process_definition :name => 'lousy example', :revision => '0.1' do
concurrence do
listen :to => 'bravo', :upon =>'reply', :wfid => true do
sequence :forget => true do
alpha
end
end
bravo
end
end
class TraceParticipant
include Ruote::LocalParticipant
def consume(workitem)
p workitem.participant_name
reply_to_engine(workitem)
end
end
engine.register do
catchall TraceParticipant
end
engine.noisy = true
wfid = engine.launch(pdef)
sleep 3
--->8---
The 'listen' with a block is forgetting its children (already), so the error
was the 'sequence' replying immediately to a gone 'listen'.
I've added the bug reproduction to the test suite and fixed the issue.
https://github.com/jmettraux/ruote/commit/6eff8ded2df0648c8d1b7ebcf6995061a365d7c4
Now, process-definition-wise, this should be sufficient
---8<---
concurrence do
listen :to => 'bravo', :upon =>'reply', :wfid => true do
sequence do
alpha
end
end
bravo
end
--->8---
Listen implicitely forgets its children (see
http://ruote.rubyforge.org/exp/listen.html).
But this concurrence segment will never terminate (unless cancelled). Bravo
will be handed a workitem once, and reply and then alpha will get triggered...
And then listen will continue listening, forever... Like a little server...
As said in the other email, maybe you simply want to do
---8<---
sequence do
bravo
alpha
end
--->8---
(when bravo is done, do alpha) or
---8<---
concurrence do
sequence do
listen :to => 'bravo', :upon =>'reply', :wfid => true
alpha
end
bravo
end
--->8---
where the 'listen' blocks until bravo replies...
Many thanks for the issue report, 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