AnsweredAssumed Answered

Blocking service tasks

Question asked by jiddo on Dec 7, 2011
Latest reply on Dec 13, 2011 by pred2k3
Hello!

I'm new to BPM frameworks and just recently found out about them (especially Activiti and jBPM5) when looking for a solution to a problem that I wanted to overcome in a project of mine (http://stackoverflow.com/questions/7859648/how-can-i-implement-a-request-response-protocol-without-blocking-while-awaiting).

I would like to be able to model my application logic using the Activiti Designer eclipse plugin and execute it as part of my application. Specifically, I will be using an asynchronious NIO framework such as Netty or Apache MINA as the backend for the networking. The protocol is however still very much of a request-response nature and as such there will potentially be long "blocking" periods between sending a request and receiving the corresponding response. Similar problems arise when awaiting incoming connections or incoming client requests.

I like the idea of modeling my network each of my request-response pairs as a "service task" in Activiti. The problem is that there might be many of these active at any one point in time and it would not be scalable for them to lock up neither the thread that is executing the Activiti process nor one of the worker/job executor threads in the thread pool.

After looking around a bit, I found that jBPM5 tasks use the separate "WorkItemManager.completeWorkItem" method to signal the completion of the task rather then ending it whenever the executor method returns (like Activiti seems to do). That would allow me to call that completion method from a separate thread, such as the asynchonious invocation from my NIO library, which would solve my problem.

Is there any feature in Activiti that would allow me to solve the problem in a similar way, or would it be convenient to add something like that? Or is there any other standard solution to this that I have overlooked?

Outcomes