2

In a spring boot app, i use JMS with QPID to receive messages from an Azure ServiceBus Queue.

I create my own connection factory with properties:

SessionsAcknownlegdeMode: CLIENT_ACKNOWlEDGE
RedeliveryPolicy Outcome: REJECTED
MaxRedelivery: 5

I use the annotation @JmsListener

Problem: When I consume the message, we try to send a mail with JavaMail, this normally works but it happened that the smtp server we use was having problem so the org.springframework.mail.MailSendException was thrown. The message is correctly retried and put in DLQ after max retries but after a few messages in error, my @JmsListener method is not invoked for the following messages, and they are put directly in DLQ. That is not what I want.

I tried to replicate this behavior locally by manually throwing exceptions in the listener for given messages, but the consumer correctly sends bad messages to DLQ and consumes good messages.

Does anyone know what is happening ?

michel
  • 31
  • 4
  • You can refer to [How to hold messages in JMS Message Queue if there are any error after consuming the message?](https://stackoverflow.com/questions/30266631/how-to-hold-messages-in-jms-message-queue-if-there-are-any-error-after-consuming) and [How to use the Spring Boot Starter for Azure Service Bus JMS](https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus) – Ecstasy Nov 10 '21 at 10:00
  • You can also open an issue on GitHub: [azure-sdk-for-java](https://github.com/Azure/azure-sdk-for-java/issues) or [azure-service-bus](https://github.com/Azure/azure-service-bus/issues) – Ecstasy Nov 10 '21 at 10:01
  • 1
    @DeepDave-MT Thanks for the comment but i'm not using azure library, I'm using QPID with JMS so I can switch between activemq and service bus. Also I understand how jms treats errored messages but in my case it doesnt event consume the following messages but put them direclty in DLQ. – michel Nov 10 '21 at 10:58
  • You can refer to [BUG azure-spring-boot-starter-servicebus-jms qpid Message is put to DLQ after MaxDeliveryCountExceeded even when message is processed without error/exception](https://github.com/Azure/azure-sdk-for-java/issues/24304) – Ecstasy Nov 10 '21 at 11:02
  • This does not seem to be my problem, in my case it seems it is not due to message lock expiring as it can happen with only one message and the message is not even received by my @JmsListnener method. I'm looking at the prefetch configuration and we use the default one, that caused another problem but at a glance it does not seems to be the cause for this one. – michel Nov 15 '21 at 10:42

0 Answers0