how can two service tasks of a single process by executed concurrently?
I have a parallel gateway which splits to two parallel service tasks (which are later joined again).
I've set the asynchronous attribute "async" to "true" on both service tasks, so that the continuation will happen asynchronously. I've also set the "exclusive" attribute to "false" on both service tasks.
In this case, both service tasks are now started concurrently and the first to finish is completed correctly. However, the second service task to finish will always fail with a OptimisticLockingException.
SEVERE: Error while closing command context
org.camunda.bpm.engine.OptimisticLockingException: ExecutionEntity[d1332687-d4e0-11e3-a07b-58946bf7bb18] was updated by another transaction concurrently
at org.camunda.bpm.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:700)
at org.camunda.bpm.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:496)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:214)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:157)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
http://docs.camunda.org/latest/guides/user-guide/#process-engine-the-job-executor-exclusive-jobs says
"[Exclusive execution] can be turned off if you are an expert and know what you are doing (and have understood this section)"
But how do I prevent the OptimisticLockingException if I know that the two service tasks are unrelated, e.g. they don't change any process variables? Or: what is the sense of the "exclusive" attribute? What is the use case for this attribute?
A workaround would be to model a "Send Task" followed by a "Receive Task", so that the "Send Task" makes a asychonous call to a service which then reports its completion to the "Receive Task" using a previously defined correlation key.
Regards
Tobias
Hi Rob.
I like this pragmatic approach :-) Only downside is that you have to add a task into the BPMN which has no business meaning…
Cheers
Bernd
--
You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/f3b0262e-92e9-42cd-9fb7-fdc9ebf3f0a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
thanks for your reponse. I've tried it and can confirm that it works.
The NoOp task in the model is not nice, but a possible solution.
@Camunda: IMHO, this workaround using NoOp should be documented in the paragraph "It can be turned off if you are an expert and know what you are doing" of the section http://docs.camunda.org/latest/guides/user-guide/#process-engine-the-job-executor-exclusive-jobs
Regards
Tobias
1) We are only really talking about the joining gateway, right?
2) Since different parallel branches might take different amounts of time to complete, is the preferred approach to set retry strategy on the gateway to be:
a) a lot of retries?
b) long delays between retries?
c) combination of both?
Thanks,
Galen
> 1) We are only really talking about the joining gateway, right?
Yes, technically you could use it on both forking and joining parallel gateway, but the joining gateway is where it makes most sense. In addition, we also added to possibility to put asynchronous continuations after tasks:
That may also be worth checking out.