12-07-2018 01:50 PM
Hi,
I have an activiti that I would be triggering which is executed in asynchronous mode. I would need to keep checking the status for the job and when it reaches either a success/failure state, I would need to go to next task. How can I achieve this? Any suggestions?
12-07-2018 03:55 PM
When you say it is executing in async mode, is that a service task with property activiti:async set to true ? If so is there a reason you are using async mode ?
I've had a similar situation, trying to see if it may be relevant.
12-09-2018 04:24 PM
My whole process would run in async mode. To achieve this, I have set the activiti:async to true just for the first task in the process so that the rest of the steps/tasks would also be running in the async mode.
But the question I asked is for a step in the process where I am calling an ETL job that would take a while to complete. As soon as the service call is made to ETL component, it schedules the job and provides an id to track the status back. So, for me as soon as the I make the first call to trigger the job, I have to keep checking the status at regular intervals to see the status and make progress in the process.
I hope I clarified your question. For now, I am checking the status using the Java Thread.sleep() method and when the status is either success/failure,
12-09-2018 04:26 PM
Sorry posted before completing the message.
But with the current approach, I can't restart the process when something fails abruptly. Pls let me know if you have any additional questions.
12-10-2018 03:25 AM
I understand, so not sure if this is any help, but I have an event listener that needs to run code its own thread so I can safely use the engine API. I don't believe you can use the async flag on a listener, so I start a new thread myself and use a synchronisation object and wait / notify so the original thread waits and I can check if it was a sucess or failure.
As your ETL step could be a long transaction, you can also change the transaction timeout I believe, I haven't needed that myself but have seen it mentioned in the user guide.
12-10-2018 08:57 AM
Thanks PaulT _! I will check that.
Explore our Alfresco products with the links below. Use labels to filter content by product module.