AnsweredAssumed Answered

Thread sleep or timer?

Question asked by jhahn on Mar 19, 2015
Latest reply on Mar 19, 2015 by yvoswillens

I have a script task that will hit an API to check if a job is finished.
I need to keep checking the API every few minutes and if the job is not finished within an hour, I need to send a notification (but keep checking the API until it's finished).

while (jobNotFinished) {
  hit API.
  if (jobFinished) {
  } else {

and I'll have a boundary timer event set to jobStartTime + 1hour to send a notification.

Is this the correct way? What would happen on a server restart if it's in the while loop?

I've thought about having an exclusive gateway that will point back to the task but not sure how I would setup a boundary timer so that it doesn't run again when it keeps running the task every 5 mins even after 1hour has past. I could set a variable to mark it as sent, but that doesn't sound "right"?

Any insight would be helpful to this BPMN noob.