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)
-
Archives
- October 2023 (1)
- October 2022 (2)
- October 2021 (2)
- February 2021 (5)
- January 2021 (4)
- December 2020 (3)
- October 2020 (2)
- August 2020 (1)
- June 2020 (1)
- April 2020 (1)
- February 2020 (1)
- December 2019 (7)
-
Categories
-
RSS
Entries RSS
Comments RSS