I have a message handler, which consumes from a JMS queue and that sends results to another JMS queue. The message handler lives in a Spring DefaultMessageListenerContainer. When the container shuts down, I would like for it to finish handling any requests that it already consumed and send out the results. At the same time, it should no longer consume any new messages from the request queue.
Right now, with no special shutdown provisions safe ApplicationContext.registerShutdownHook(), the container waits for any pending listernerMethod invocations to return, but it isn't sending out the results to the response queue.
What would be the appropriate approach for making sure that responses produced by running handlers are sent to the response queue?