Sorry, I didn't give enough details of my problem. 

I have a participant called finalized , the class is Finalized.
In my test workflow, that looks like this:
  Ruote.process_definition :name => 'normal', :revision => '0.1' do
    sequence do
      lower_case_string
      trim_string
      write_results_to_log
      finalized
    end
  end

Then my finalized participant is called. I put a debugger there and I am 
stopped there. 

If I delete the participant from this workflow, so I have this:
  Ruote.process_definition :name => 'normal', :revision => '0.1' do
    sequence do
      lower_case_string
      trim_string
      write_results_to_log
    end
  end

BUT I do this:
    # @engine.register_participant ....
   #  
   @engine.on_terminate = 'finalized' 
   # 
   # @engine.launch ....

Then the participant is not called, debugger will not stop, etc. 
This is what I meant by not working.


And yes, for my case I would need that the termination participan run under 
the same flow (same wfid) than the others.



On Friday, July 20, 2012 5:20:59 PM UTC+9, John Mettraux wrote:
>
>
> On Thu, Jul 19, 2012 at 11:47:40PM -0700, jordi wrote: 
> > 
> > Thank you very much for your detailed explanation. 
> > 
> > For easy of implementation I want to store this information in the same 
> > place where the participant is being stored. I really didnt want to make 
> a 
> > table in a DB. 
> > I really liked the approach of using a listener for events but couldn't 
> > make it work. 
>
> Hello Jordi, 
>
> how so? This works well with the "master" ruote: 
>
>   https://gist.github.com/3149458 
>
> What does your code look like? 
>
> > I made a participan called finalized and registered it like this 
> >     @engine.register_participant 'finalized', Ruote::StorageParticipant 
> > 
> > I am not sure if this is the best thing to do but it will keep the 
> workflow 
> > in this step forever, so I can always ask for this wfid and get 
> 'finalized' 
> > as step 
> > I have tried this: 
> >    @engine.on_terminate = 'finalized' 
> > but it does not call the participant when the workflow is finalized. 
> > When I have the participant 'finalized' in the workflow itself it works. 
> > 
> > So, I would need to write 'finalized' as last participant in all my 
> > workflows. What is not very elegant but I prefer that to the other 
> > approaches. 
> > Any idea why  @engine.on_terminate = 'finalized'  does not work? 
>
> It works very well. At least for me: 
>
>   https://gist.github.com/3149472 
>
> When I read "couldn't make it work" or "does not work", I'm tempted to 
> link 
> to: 
>
>   http://www.chiark.greenend.org.uk/~sgtatham/bugs.html 
>
> but the first step is to manage expectations... You're not really 
> describing 
> what you expect and I'm telling you it's working as expected (why would I 
> waste time writing tests else 
> https://github.com/jmettraux/ruote/tree/master/test ) 
>
> What I expect from on_terminate: that, each time a workflow terminates, it 
> uses a copy of the workitem of the just terminated flow to either a) 
> launch a 
> new subflow b) launch a new subflow containing only a call to the named 
> participant. I'm not expecting it to append the participant or the subflow 
> at 
> the end of the terminated (not terminating) flow. 
>
> Quoting the documentation: 
>
>   http://ruote.rubyforge.org/configuration.html 
>
> | There are the on_error and the on_cancel attributes common to all 
> | expressions. Engine#on_error and #on_terminate are quite close to those, 
> but 
> | there is an important catch. The on_error attribute will cancel the 
> | expression to which it is attached and then run the on_error ‘routine’, 
> while 
> | Engine#on_error runs independently of the process whose error triggered 
> the 
> | reaction. Same thing for on_terminate. 
>
> I realize there is something bothering with on_terminate: it doesn't 
> contain 
> the wfid of the flow that just terminated. You can't correlate the 
> on_terminate flow with the terminated flow. I have to do something about 
> this: 
>
>   https://github.com/jmettraux/ruote/issues/53 
>
> Thanks for making me realize that. 
>
>
> Kind 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

Reply via email to