I am exposing wM service as webservice to outside. when the service is invoked at realtime, I want to query and based on query result, i want to perform database operations. I want a delay of 15 minutes from the time the webservice is invoked realtime to performing database operations on downstream system. is using sleep service a good option and what are other alternatives. thank you.
What will you return to the client at the initial service invocation? I assume you’ll return some type of transaction ID that can be used in a subsequent service request to get the results of the query.
Your initial service can simply persist the request to a database table which is later polled by a scheduled job. Results of the query must be written to some other table using the transaction ID as a key. Another web service operation would be needed to allow the consumer to retrieve the results of their query using the transaction ID.
Sleeping for 15 minutes is not a good solution as it could potentially result in lots of sleeping threads.
If I persist initial request to database and poll by scheduled service, if the scheudle service has 15 minutes interval, some of the requests might not have completed 15 minutes gap.
So, just don’t select any pending requests that are not 15 minutes old. My reponse gave you a framework, you have to fill in the details.