Problem Statement : I am executing a REST API and getting the response which gives a String based status of a job which is either "RUNNING","COMPLETED","FAILED" etc and I want a GENERIC monitoring mechanism that will use Timer to delay the REST call based on intervals (with a time out) and check the status, i.e if status is RUNNING, wait for an interval of 30 secs and again execute the REST Call.
It should exit out of the monitoring code if either the Timer times out based on the timeout value provided or if the status moves to COMPLETED or FAILED state.
The execution of the REST API would be implemented in a method. And therefore I want the monitoring mechanism to be generic so that I could use it for any REST API(method) that needs to be monitored and thus, if the callback mechanism is provided with the detail of which method to execute, it carries it out accordingly.
Could anyone please provide some suggestions on implementing this solution. The callback mechanism is fairly new to me and thus a little help is required on that front.
Appreciate all responses.
Thanks in advance.
