On Wed, May 26, 2010 at 03:41:16PM -0500, Wes Gamble wrote:
>
> How do I get my workitem to move?
OK, let me give you some sample code :
---8<---
require 'rubygems'
require 'ruote'
pdef = Ruote.process_definition :name => 'test' do
cursor do
participant 'alpha'
participant 'bravo'
end
end
$engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new()))
$sp = $engine.register_participant '.+', Ruote::StorageParticipant
$engine.launch(pdef, 'message' => 'hello')
sleep 1
def p_workitem_info
puts "=== wi info ==="
$sp.each do |wi|
p [ wi.participant_name, wi.fei.wfid, wi.fields['message'] ]
end
end
p_workitem_info
# ok, there is a stored workitem for participant 'alpha'
# let's get it, modify it and push it back to the engine
wi = $sp.first
wi.fields['message'] = 'guten Tag'
$sp.reply(wi)
sleep 1
p_workitem_info
# the engine pushed the workitem up until participant 'bravo'
--->8---
Example output :
=== wi info ===
["alpha", "20100526-bediripagu", "hello"]
=== wi info ===
["bravo", "20100526-bediripagu", "guten Tag"]
Please note that I am not using StorageParticipant#by_wfid. I just pick the
first workitem on the "stack".
When we chatted yesterday, you talked to me about the StorageParticipant#reply :
> 2010-05-25 23:47:55 utc weyus: How do I tell the current participant to "let
> go" of the item - that's a "reply" correct?
http://ruote.rubyforge.org/irclogs/ruote_2010-05-25.txt
Look at how I'm using it now. I modify the payload of the workitem (guten Tag)
and then I "let go" of the workitem.
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