Scheduled call to a service task

I am new to BPMN model and Camunda. I have a very basic question - I currently have a Spring boot Java code with @Scheduled annotation which fetches a job status for an interval until the job status is either failed or completed. At that point, it stops polling.

How can I model this using the camunda modeler? I have done something like this but not able to put the timer for an interval.

Hello @Arnab_Naha ,

here, you could use the intermediate timer event in the loop. It can wait for a certain duration.

Hope this helps

Jonathan

@jonathan.lukas So will this work?

I have put the Timer definition as Duration and value PT15M
So it should trigger the service task “Status check and notification” every 15 mins until the status is Failed or Completed.
Is my understanding correct?

Hello @Arnab_Naha ,

yes, this will do.

Just one question as I am not a friend of polling: Can this be transformed into a callback pattern? The engine is able to wait for a callback very well.

Jonathan

To be honest I am not sure whether we can convert this into a callback pattern or not. As our service will be getting the status of the job from an outside system, but lets say if we convert it into a callback; How the model will change for this problem

Hello @Arnab_Naha ,

then you could, instead of executing the polling service call, just wait for a message (Intermediate Message Catch Event) which could be named like „Testing done“. After that message arrived, you could then execute the next service call „Send Final Notification“.

Sorry I did not attach an example pic or bpmn file, I use my phone right now…

I hope this helps though

Jonathan

Thanks, @jonathan.lukas for the explanation. Actually, the business ask is to send periodical job status and metrics. If it is just starting and finishing the job. probably we could go with the callback pattern

1 Like