I am using the azure-servicebus-jms-spring-boot-starter to listen for messages from a Microsoft Azure queue. The Azure Service Bus api has a PEEKLOCK setting, azure.servicebus.subscription-receive-mode=PEEKLOCK, that requeues the messages in the event that processing the message fails. Is there a similar setting for the spring JMS listener?
1 Answers
You can specify two different modes in which Service Bus receives messages: ReceiveAndDelete or PeekLock.
In PeekLock mode, the receive operation becomes two-stage, which makes it possible to support applications that cannot tolerate missing messages.
When Service Bus receives the request, it finds the next message to be consumed, locks it to prevent other consumers from receiving it, and then returns it to the application. After the application finishes processing the message (or stores it reliably for future processing), it completes the second stage of the receive process by calling CompleteAsync on the received message. When Service Bus sees the CompleteAsync call, it marks the message as being consumed.
For more details, you could refer to this article.