[jboss-user] [jBPM] - Asynchronous service tasks and transactions

Rahul Agrawal do-not-reply at jboss.com
Fri Aug 24 02:10:03 EDT 2012

Rahul Agrawal [https://community.jboss.org/people/rahulamt] created the discussion

"Asynchronous service tasks and transactions"

To view the discussion, visit: https://community.jboss.org/message/755652#755652

jBPM5.2 documentation states the following.

h3. 5.8.7. Multi-threading

"When a service task is reached in the process, the engine will also invoke the handler of this service synchronously. This means that the engine will wait for the completeWorkItem(..) method to return before continuing execution. Therefore, it is important that your service handler executes your service asynchronously if its execution is not instantaneous. Image for example you want to invoke an external service. Since the delay of invoking this service remotely and waiting for the results might be too high, it might be a good idea to invoke this service asynchronously. This means that the handler will only invoke the service asynchronously and will notify the engine if the results are available...."

But how to notify the engine that the execution is complete and the it can continue the execution. The suggested way is to use completeWorkItem(..). But If i try to invoke this in the thread that I have started, the entity manager is flushing the persistence context.

If I explicitely flush the entity manager then for back-to-back service tasks the entity manager is not flushed even if I explicitely say EntityManager.flush().

Please help!!

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120824/ff9a1e81/attachment-0001.html 

More information about the jboss-user mailing list