Timer boundary event not supported for Service Task?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2012 02:57 PM
I have learned in my own testings (jobExecutorActivate=true) and from the forums that timer boundary event is not supported for service task. Can anyone confirm? This will impact us significantly because most of our flow components are service tasks either calling external web services or java classes executing locally. We basically would like to time all activities in case of any unresponsiveness of elements, just like Autosys' Max Run Time.
Oracle has this implemented for sure. Although we are always able to implement a time checking thread running in parallel with the java task, it is not so elegant even in workflow diagram perspective. Does anyone have any kind of workaround?
Happy Holidays
Sean
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2012 12:27 PM
Now, the best practice is to have a short-lived service task, that simply triggers an external something. After the service task, there should be a receive task. the external entity can then trigger the process instance again. That way, the transactions are short, as they should be. If you need a timer, just put it on the receive task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2012 05:01 PM
Thanks for the advice. Several of us do have your "Activiti in Action".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2013 11:29 PM
Secondly, what would be the semantics of cancelActivity="true" if ServiceTasks are always just asynchronous submit? There is SendTask concept in BPMN for async submits.
Not to mention that DataSet-associated wait may also induce blocking on any Activity, which may be desirable to handle via timeout.
But even in practical terms, what about service tasks that are implemented via Camel (i.e. delegateExpression="${camel}"). The Camel route can take some time and I would like to be able to detect timeouts.
I can rewrite CamelBehaviour myself and i.e. run Camel on a thread pool, then posting an event, and having Timer Boundary event on my ReceiveTask in my process. But it would be nice to (A) have support for it out of the box from Activiti, and (B) this kind of hacking complicates flows, instead of naturally using just one box (ServiceTask) I have to remember/document to use 2 boxes, ServiceTask + ReceiveTask.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2013 09:10 AM
That's a valid point. Based on this discussion we are thinking to provide out-of-the-box support for this pattern.
We could introduce a new service task type that allows you to add a timer boundary event.
Under the hood the pattern will probably be implemented with Camel in the background and an additional receive task, but you don't need to configure this yourself.
Would that be helpful?
Best regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2013 05:07 PM
Just off the top of my head - one way of doing this would be to provide another variety of ActivityBehavior interface, for example:
public interface ActivitiInterruptableBehavior { // Or ActivitiStatefulBehavior
void setExecution(ActivityExecution execution);
void execute() throws Exception;
void interruptExecution(); // best-effort, exceptions ignored, not to confuse with compensation (which is for previous steps)
}
so if my activity:class or activity:delegateExpression resolves to implementation of this interface, the Activiti can assume that (1) boundary timer events should be supported; and (2) optionally, developers can choose to handle cancellation (i.e. stopping long upload/download). This would also mean the instances of ActivitiInterruptableBehavior can be stateful (I think currently instances of ActivitiIBehavior are per-process def, not per execution).
I think BPMN spec does not tell what cancel=True really means for the activity implementation. I may be wrong but I think it may be useful and it does not break the BPMN semantics.
Or, this interrupt-ability and timeout-ability can be communicated to Activiti via Java annotations.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2014 07:47 AM
Do we have any update on the service task which allows to add timer boundary event?
Thanx.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2014 06:13 AM
No we didn't do development in this area yet. What would be your use case for needing this?
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2015 01:22 AM
For a service task that does the request/reply, I just found the following post: http://forums.activiti.org/comment/9956#comment-9956. However this doesn't yet address any timeout handling via a timer boundary event.
Anything that can be done in this area to make modeling these scenarios simple and quick for Business Analysts?
Maarten
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2015 03:51 AM
A more complex implementation could mimic this behaviour and hide the event in the diagram by creating a TimerEntity in the execute() method there.
