ugh, I meant ParticipantExpression#apply method.

--
Raphael.

On Thu, Feb 10, 2011 at 10:37 PM, Raphael Simon <[email protected]>wrote:

> Bah of course, I see it in the participant dispatch methods 10 seconds
> after sending my email :) So yes that works perfectly, thank you!
>
> --
> Raphael.
>
>
> On Thu, Feb 10, 2011 at 10:34 PM, Raphael Simon 
> <[email protected]>wrote:
>
>> John, this looks great... I'm wondering if I could trouble you with
>> explaining a little bit where the flow expression and its workitem get
>> persisted? I don't see the dispatch pool persisting it before dispatching so
>> it must be prior to the worker getting the dispatch message but I couldn't
>> put my finger on exactly where that happens.
>>
>> Thank you!
>>
>> --
>> Raphael.
>>
>>
>> On Thu, Feb 10, 2011 at 7:42 PM, John Mettraux <[email protected]>wrote:
>>
>>>
>>> On Thu, Feb 10, 2011 at 02:48:16PM -0800, Raphael Simon wrote:
>>> >
>>> > The title says it all: I'm writing a participant and it needs to
>>> retrieve
>>> > the workitem that was consumed prior to the expression being cancelled.
>>> What
>>> > I ended up having to do was to basically copy/paste the
>>> StorageParticipant
>>> > code to store and retrieve the workitem. This doesn't seem ideal
>>> though. I
>>> > could have my participant inherit from StorageParticipant and reuse the
>>> > consume and reply method there but that also does not seem ideal (makes
>>> my
>>> > participant brittle as it relies in the internal behavior of
>>> > StorageParticipant). I am wondering if there should be a more generic
>>> > mechanism for stashing/retrieving/deleting the workitem for a given
>>> > expression. Both the StorageParticipant and mine could rely on this.
>>> I'm
>>> > happy doing that refactoring and contributing it back but I wanted to
>>> first
>>> > check that I am not missing anything.
>>>
>>> Hello Raphael,
>>>
>>> would that help ?
>>>
>>>  https://gist.github.com/821882
>>>
>>> ---8<---
>>> require 'rubygems'
>>> require 'yajl' # or 'json'
>>> require 'ruote'
>>>
>>> engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new))
>>>
>>> pdef = Ruote.process_definition do
>>>  alpha
>>> end
>>>
>>> class Alpha
>>>  include Ruote::LocalParticipant
>>>
>>>  def consume(workitem)
>>>    # do nothing, do not even reply to the engine
>>>  end
>>>
>>>  def cancel(fei, flavour)
>>>    #p workitem(fei)
>>>    puts "the workitem as it reached the participant expression :"
>>>    p applied_workitem(fei)
>>>  end
>>> end
>>>
>>> engine.register_participant :alpha, Alpha
>>>
>>> engine.noisy = true
>>>
>>> wfid = engine.launch(pdef)
>>>
>>> engine.wait_for(:alpha)
>>>
>>> engine.cancel(wfid)
>>>
>>> engine.wait_for(wfid)
>>> --->8---
>>>
>>> this #applied_workitem(fei) method is hidden in the ReceiverMixin (which
>>> is included in Ruote::LocalParticipant).
>>>
>>> (Making a note to link to this discussion thread from the documentation).
>>>
>>>
>>> Cheers,
>>>
>>> --
>>> 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
>>
>>
>>
>

-- 
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