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?
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,
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.