cancel
Showing results for 
Search instead for 
Did you mean: 

Invoke external non-transactional services

smedina
Champ in-the-making
Champ in-the-making
Hi, i'm using Activiti v5.9 to implement a process with about 10 subprocess.

The process performs a lot of invocations to external services (non-transactional) that we would like to make asynchronously. We can use a service task with the option activiti:async="true" to commit the process status at the beggining of each invocation, but it starts a new transaction that remains open during the whole execution of the task. The invocation to these external services can take a long time in some cases, so we would like to implement the call with no transaction active.

The option we found to implement this, is to include for each invocation, a service task, that invokes an internal service that stores the invocation request to be processed in background, and a receive task to sleep the process until the invocation is complete.

This solution complicates the process definition by adding this invoke/wait tasks on each external invocation inside our subprocess. I would like to know if there is a way to "compose" these two activities (service task / receive task) in a new custom task, to simplify our process, avoiding the overhead of defining and calling a new subprocess to do this.

Thanks in advance,
Santiago Medina.
1 REPLY 1

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Yes, you can, by implementing a servicetask that implements the activitybehaviour interface. See the docs for this and e.g the UserTask implementation.