On Tue, Aug 07, 2012 at 04:05:46AM -0700, laurent wrote:
>
> I use "ruote-on-rails" as starting point, and a derived my on class
> "MyParticipant" from "Storgage particpant".
>
> When I check the workitem received by the "accept?" methode, these workitem
> is empty. When I check the workitem in the "on_workitem" method, the
> workitem is not empty.
> Is it normal ?
Hello again Laurent,
yes, it's normal.
If I run
---8<---
require 'rufus-json/automatic'
require 'ruote'
dboard = Ruote::Dashboard.new(Ruote::Worker.new(Ruote::HashStorage.new))
dboard.noisy = false
class MyParticipant
include Ruote::LocalParticipant
def on_workitem
p [ :on_workitem, workitem.fields ]
reply
end
def accept?
p [ :accept?, workitem.fields ]
true
end
end
dboard.register_participant 'toto', MyParticipant
wfid = dboard.launch(Ruote.define do
toto
end)
dboard.wait_for(wfid)
--->8---
I get:
---8<---
[:accept?, {}]
[:on_workitem, {"params"=>{"ref"=>"toto"}, "dispatched_at"=>"2012-08-07
11:14:49.069032 UTC"}]
--->8---
The fields "params" and "dispatched_at" are set when the workitem is
dispatched to the participants.
The #accept? method is an advanced feature (as a beginner you must have a very
solid reason to use it), it's called to make a dispatch decision on the
participant implementation. At this point "params" and "dispatched_at" are
not set.
Those two fields should not be necessary when taking the #accept? decision.
Once again: #accept? is an advanced feature. Beware!
Best regards,
--
John Mettraux - http://lambda.io/jmettraux
--
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