Ravindar, Integrations with Mulesoft & BizTalk

Just another Integration blog

Get the retried count of a message in ActiveMQ Queue in Mule 4

ActiveMQ provides several properties that can be used when we need them. You can look at the available properties here

There properties will be made available in Mule flow when the message is dequeued using JMS connector.

We have had a requirement to handle retry mechanism when the dequeued message fails and after x retry attempts, we had some business logic to be done.

So how do we know what’s the current retry attempt count?

We can rely upon the property JMSXDeliveryCount provided by ActiveMQ. This property initial value will be 1 and will be incremented by 1 every time it is retried

You can read this attribute in Mule 4 like below


attributes.properties['jmsxProperties'].'jmsxDeliveryCount'

following is a snap of the dubugger mode that shows list of properties available in mule flow when a message is dequeued from ActiveMQ.
if you notice, these properties are not part of headers. They’re under “properties/jmsxProperties” (some other ActiveMQ  properties will be available under headers too)

JMSProperties

January 7, 2021 Posted by | ActiveMQ, Mulesoft | Leave a comment