AnsweredAssumed Answered

Modelling an async user wait on a long running service task.

Question asked by alistairb on Apr 19, 2013
Latest reply on Apr 10, 2018 by haridaniel

I have a scenario where I have long running evaluation service task (Java Delegate) that I need to run asynchronously so that I can provide user feedback experience, i.e. a spinner in a web application, whilst waiting for the service task to complete.  Having seen the parallel gateways feature, combined with async=true and exclusive=false, I thought I had the tools to model this behaviour in BPM. 

I'm using Activiti 5.9 (and have tried 5.10 also) and launching the the default Activiti job executor but there appears to be some form of race condition as when polling for completion of the evaluation service, it appears to wait 5 minutes before executing the job(service) and I then end up with stale process instance variables beyond the continuation of this sub-process.  I've spent some time experimenting with different combinations of async/exclusive settings etc, but without success. 

I guess I'd like to clarify whether I'm modelling this process incorrectly in BPM terms as it must be a very common scenario for users of web based applications interacting with a process; For standard interaction the user makes a request to the server, and waits for the next user task, with Activiti determining the next user task to route to via the process definition.  In this case with it being a long running task, the user needs to be redirected somewhere where they are informed the task is in progress, and modelling a parallel process seemed like a logical approach as I could create a page, spinning of a polling action and then transition to complete the user task when the job has finished.

If there are any recommended approaches/patterns to follow then I'd be very grateful to hear about them.

Many thanks