Some process in my project needed a few minutes(1~10min). and I provide the result of this process using spring boot web. so my API have to return the response with status(queueing/running/finished/failed). so I made kind of this attributes implement by ResponseEntity Class.
My request flow is
- User request
- javascript call the API with parameter
- server make job using request's attribute(parameter, user information)
- check the job already exist. if not, put the job to the queue. if exist, return the now job status(finished job has the result of the process).
QueueExecutor runs the new job to processing component and then make the thread for checking periodically.
- user's client request periodically. and get the job is queueing/running/finished using setInterval(). if not finished, pass. else, run the UI process.
In my flow, I have many little problems so I want to know that is there any general or useful library or solutions. please advice to me. thanks.