This is the problem I am facing that is related to design and implementation:
I have a REST web service that accepts POST requests. There is nothing special about this. He is currently responding synchronously.
However, this web service is about to initiate a background process, which may take some time.
I do not want this service to respond in 30 minutes.
Instead, it should immediately return an ack response to the client, and nothing more (even after 30 minutes the information will no longer be sent).
How do I implement this behavior with Jersey?
I read the page https://jersey.java.net/nonav/documentation/2.0/async.html#d0e6914 .
Although it was an interesting read, I did not find a way to send only an ACK response (something like HTTP 200 code).
Perhaps I am confused with asynchronous and the behavior that I want to implement.
I just realized that I could create a new thread in my @POST method to process the background process and immediately return the ACK response.
But does this new thread work after the response has been sent back to the client?
How would you implement this WS?
I hope you can help me clarify this point.
source share