[Azure Service Bus] JMS messages getting dead-lettered
The article discusses a problem where numerous messages end up in the dead letter queue (DLQ) when the JMS service bus consumer connects to the Azure Service Bus using Qpid jars. The reason for the messages being dead-lettered is that they have reached the maximum delivery count.
The fundamental issue stems from Apache Qpid's message handling. Qpid utilizes a local buffer to prefetch messages from the Azure Service Bus, storing them prior to delivery to the consumer. The complication occurs when Qpid prefetches an excessive number of messages that the consumer is unable to process within the lock duration. Consequently, the consumer is unable to acknowledge or finalize the processing of these messages before the lock expires, leading to an accumulation of messages in the Dead Letter Queue (DLQ).
To address this problem, it is crucial to either turn off Qpid's local buffer or modify the prefetch count. Disabling prefetching is achievable by setting jms.prefetchPolicy.all=0 in the JMS URL. This configuration allows the JMS client to directly consume messages from the Azure Service Bus, circumventing Qpid's local buffer. Consequently, the consumer can process messages at a suitable pace, guaranteeing smooth processing and issue-free completion.
Why is Prefetch not the default option in Microsoft .NET/Java/Python libs?
Published on:
Learn moreRelated posts
Azure SDK Release (July 2026)
Azure SDK releases every month. In this post, you'll find this month's highlights and release notes. The post Azure SDK Release (July 2026) ap...
How AMD and Azure push the boundaries of compute
Azure OpenAI Service: Complete Guide for Beginners
Introduction Artificial Intelligence is transforming how businesses build software, automate workflows and deliver personalised customer exper...
Find any commit in seconds: Commit Search comes to Azure DevOps
Great code has a long memory. The fix you shipped last quarter, the refactor that touched a dozen files, the one-line change that explained wh...
Using Azure OpenAI to Auto-Summarize Dataverse Case Notes – AI Integration + Dataverse CE
Why I Built This If you work in Dynamics 365 Customer Service or any Dataverse CE environment, you already know the pain: a single case can ac...