I'm using jmsTemplate.receive("queueName")
to receive data from service bus queue.
I'm using it as an API request.
One issue I'm facing is if no message left to process from the queue it's not completing the request, not even throwing an error. Is there any way in jmsTemplate
to check if no data is to process then it should stop the request.
I tried so many approaches but none works.
You have to call jmsTemplate.setReceiveTimeout before calling
jmsTemplate.receive
.When not set, it waits forever for the next message, as written in the Java doc: