Re: [ruote:3593] What is the proper way to handle exceptions

49 views
Skip to first unread message

Danny Fullerton

unread,
Jun 18, 2012, 3:50:04 PM6/18/12
to openwfe...@googlegroups.com
Hello,

You should find what you need in the participant, not the storage.

http://ruote.rubyforge.org/implementing_participants.html#cancel

Regards,

--
Danny Fullerton, CISSP GCIH GHTQ
Founder
Mantor Organization

Sent from mobile

ddeng <dengti...@gmail.com> wrote:

>Hi,
> I have a workflow like:
>sequence :on_cancel=>:report_error do
> alice
> bob
>end
>
>I want report_error to be called if alice or bob fails to do the job. Both
>alice and bob are storage_participant. I only found
>StorageParticipant#proceed method, but is there a cancel method for the
>workitem?
>So I can have something like:
>workitem.cancel if not alice.do(workitem)
>
>Thanks in advance
>
>--
>you received this message because you are subscribed to the "ruote users" group.
>to post : send email to openwfe...@googlegroups.com
>to unsubscribe : send email to openwferu-use...@googlegroups.com
>more options : http://groups.google.com/group/openwferu-users?hl=en

ddeng

unread,
Jun 18, 2012, 4:20:28 PM6/18/12
to openwfe...@googlegroups.com
Thanks Danny,
I also found there is a cancel method in Dashboard. But when I cancel a wokitem for alice, bob will still get the job. So I am wondering.....What is the difference between cancel and proceed?

John Mettraux

unread,
Jun 18, 2012, 6:28:01 PM6/18/12
to openwfe...@googlegroups.com

On Mon, Jun 18, 2012 at 01:20:28PM -0700, ddeng wrote:
>
> I also found there is a cancel method in Dashboard. But when I cancel a
> wokitem for alice, bob will still get the job.

Yes, that's right. And the on_cancel you placed on the parent 'sequence' will
not trigger since the expression that got cancelled is the alice participant
expression, not the sequence expression.


> So I am wondering.....What
> is the difference between cancel and proceed?

Dashboard#cancel(wfid_or_fei)

cancels a whole process instance (wfid) or only a branch of a process
instance (fei).

StorageParticipant#proceed(workitem)

will "unstore" the workitem and reply with it (and its potentially updated
fields) to the participant expression that emitted it. That usually makes the
flow resume.


Best regards,

--
John Mettraux - http://lambda.io/jmettraux

John Mettraux

unread,
Jun 18, 2012, 6:59:49 PM6/18/12
to openwfe...@googlegroups.com

> ddeng <dengti...@gmail.com> wrote:
> >
> > I have a workflow like:
> >sequence :on_cancel=>:report_error do
> > alice
> > bob
> >end
> >
> >I want report_error to be called if alice or bob fails to do the job. Both
> >alice and bob are storage_participant. I only found
> >StorageParticipant#proceed method, but is there a cancel method for the
> >workitem?
> >So I can have something like:
> >workitem.cancel if not alice.do(workitem)
>
On Mon, Jun 18, 2012 at 03:50:04PM -0400, Danny Fullerton wrote:
>
> You should find what you need in the participant, not the storage.
>
> http://ruote.rubyforge.org/implementing_participants.html#cancel

Hello Deng (and Danny),

I recently did some work about propagating more easily errors happening in
remote participants to the engine/workers:

https://github.com/jmettraux/ruote/commit/2e752ebb4d29c2621ca19e6cf8cc9cd3cf38e74a

I'll cook up something in the Receiver/StorageParticipant that leverages that.
I hope to be done with this work by tomorrow, I'll notify you about it in this
mailing list thread. Stay tuned.

John Mettraux

unread,
Jun 19, 2012, 11:04:19 AM6/19/12
to openwfe...@googlegroups.com

On Tue, Jun 19, 2012 at 07:59:49AM +0900, John Mettraux wrote:
>
> I recently did some work about propagating more easily errors happening in
> remote participants to the engine/workers:
>
> https://github.com/jmettraux/ruote/commit/2e752ebb4d29c2621ca19e6cf8cc9cd3cf38e74a
>
> I'll cook up something in the Receiver/StorageParticipant that leverages that.
> I hope to be done with this work by tomorrow, I'll notify you about it in this
> mailing list thread. Stay tuned.

Hello,

I've just added a #flunk method to the storage participant:

https://github.com/jmettraux/ruote/commit/4bb2d9903b7405855e0369d63dff5aea61e04580

Here is an example of its use, one that should map your use case:

https://gist.github.com/2954664


I hope it helps, questions are welcome, best regards,

ddeng

unread,
Jun 19, 2012, 2:07:56 PM6/19/12
to openwfe...@googlegroups.com
John:

ddeng

unread,
Jun 19, 2012, 2:08:49 PM6/19/12
to openwfe...@googlegroups.com
John:
That is exactly what I want, thank you for quick response. I am enjoying it in my program :)


On Tuesday, June 19, 2012 11:04:19 AM UTC-4, John Mettraux wrote:
Reply all
Reply to author
Forward
0 new messages