Catching boundary message/signal event thrown from same task

423 views
Skip to first unread message

galen...@gmail.com

unread,
Mar 3, 2014, 2:58:24 PM3/3/14
to camunda-...@googlegroups.com
Hi,

I was wondering if it's possible to have a serviceTask (via code in the corresponding JavaDelegate) programmatically call one of the RuntimeService methods like:

messageEventReceived

OR

signalEventReceived

and have a boundary event on the same task catch this message (or signal).

From what I've tried this does not seem possible, as I get errors about a message listener not existing for the message that's thrown. So it seems like the boundary event gets setup after the javaDelegate executes?

I guess I'm a bit puzzled, because I'm able to get error boundary events to work (i.e. if a BpmnError is thrown, the boundary error event on the same task is able to handle it).

It would be awesome if I could do something like this:

http://camunda.org/share/#/process/68465d02-12cc-4cc2-aa3f-0e3dc5ace574

I know that I can set variables and insert a gateway after the service task to accomplish the same type of flows. I was just curious if the above scenario was possible.

Basically, I'm trying to achieve a pattern where a service task can end in:

1) Failure
2) Success (flow just continues on)
3) Event (a special event that dictates flow). **This is what I'm trying to achieve with my example above.

Any links/advice about best practices with regards to the end "Event" flow would be great as well.

Thanks,
Galen

webcyberrob

unread,
Mar 3, 2014, 4:26:35 PM3/3/14
to camunda-...@googlegroups.com, galen...@gmail.com
Hi Galen,

I tend to reserve interrupting events for events triggered outside of the engine, or at least the current process instance. Given your service seems to remain 'in control', would you be better off just setting a process variable with an outcome and use a decision gate to control flow?

For example, if my service task was Assess Credit, I could try and generate a good or bad event, however I would typically model this as a decision variable with a decision gate...

regards

Rob

galen...@gmail.com

unread,
Mar 3, 2014, 4:55:43 PM3/3/14
to camunda-...@googlegroups.com, galen...@gmail.com
Hi Rob,

I think you are right, and I'm leaning towards using outcome variables, and decision gates to model these kind of situations. In fact, that's currently how I have it modeled. I'm just thinking about other possible ways to do this, and weighing the pros and cons. Thanks for the input.

Galen

Reply all
Reply to author
Forward
0 new messages