We are working on project that involves processing messages from Azure Service Bus using Spring Integration. Immediately after consumption, it is offloaded on to a different thread of execution. In case of an exception while processing the message, we would like to move it to Azure Service Bus Source Queue/Topics Dead Letter subqueue or either propagate exception back so that Azure service bus inbound adapter will handle it. We have tried couples of approaches:
- As of today, the java SDK for Azure Service Bus only allows us to move messages to the dead letter queue/topic by using a Service Bus Receiver, which is a component that receives and handles messages. As we use Spring Integration to connect to Azure Service Bus, we do not have control over the receivers that could move the messages to the dead letter queue or topic. We have tried to use dead letter path similar to way receiver does and move a message, which didn’t work.
- Create an instance of ServiceBusReceiverAsyncClient and tried to publish to dead letter. This wasn't successful as the message was settled/acknowledged
We request your support in suggesting us a way to move message to dead letter or propagate the exception back to ServiceBusInboundAdapterChannel so that it could move the message after certain retries.