ProstDev ProstDev
Tutorials Nov 9, 2021 · 3 min read

How to configure Solace DMQ (Dead Message Queue) through the Mule JMS connector

In this post, I will be explaining how to configure Solace DMQ through the Mule JMS Connector. There can be many business scenarios where the processing of the message will be delayed by a predefined amount of time. In such scenarios, we can make use of the concept of the TTL property and the DMQ.

By Pravallika Nagaraja
How to configure Solace DMQ (Dead Message Queue) through the Mule JMS connector

In this post, I will be explaining how to configure Solace DMQ through the Mule JMS Connector. There can be many business scenarios where the processing of the message will be delayed by a predefined amount of time. In such scenarios, we can make use of the concept of the TTL property and the DMQ.

Dead Message Queues

By default, Guaranteed messages are removed from a durable endpoint’s message pool and discarded when:

  • The number of redelivery attempts for a message exceeds the Max Redelivery value for the original destination endpoint;
  • Or, a message’s Time-To-Live (TTL) value has been exceeded and the endpoint is configured to respect message TTL expiry times.

If you don’t want the messages to be discarded, they can be moved to a dead message queue (DMQ) assigned to the endpoint.

How DMQs Work

Any durable queue on the same Message VPN as the endpoint that the messages are being removed from can be assigned as a DMQ.

Messages flagged as DMQ-eligible by the publishing client will be sent to the endpoint’s DMQ rather than be discarded.

However, if an endpoint’s assigned DMQ doesn’t exist, then the removed Guaranteed messages will still be discarded even if they are DMQ-eligible. By default, each durable endpoint is assigned a DMQ named DEAD_MSG_QUEUE, but this queue does not pre-exist and must be created by a management user.

Now let us see the steps involved in setting up DMQ and TTL.

1. Enabling the “Publisher Messages DMQ Eligible” property in the JMS JNDI of the Message VPN

Log in to Solace Cloud Message VPN. (Please refer to my first blog, “How to integrate Solace PubSub+ Cloud with MuleSoft,” which explains how to create a Solace Cloud Trial account and how to spin up a Service in Solace).

Click on JMS JNDI —> Click on Connection Factories —> Click on /jms/cf/default —> Scroll down and enable the property “Publisher Messages DMQ Eligible” as highlighted in the screenshot below.

Solace JMS connection factory settings with "Publisher Messages DMQ Eligible" toggled on

2. Creating Queues and Topics

Create the new Queues and their corresponding Topics as shown below. As part of the POC, our queues of interest are highlighted below.

Solace Queues list highlighting test-queue-1 and test-queue-2

3. Setting up DMQ and TTL in the “test-queue-1” queue

In the advanced settings of the test-queue-1 enable the ‘Respect TTL’ and set the ‘Maximum TTL’ as 180 seconds (this can be set based on our need). Also, set the ‘DMQ Name’ as test-queue-2. As per this setting, whenever any message reaches test-queue-1, the message stays in this queue for 180 seconds before it’s pushed to DMQ (test-queue-2).

test-queue-1 settings: DMQ Name test-queue-2, Respect TTL on, Maximum TTL 180 seconds

4. Publishing Message to Solace Topic with SOLACE_JMS_PROP_DEAD_MSG_QUEUE_ELIGIBLE set to true

In the solace-jms-publish.xml, I added an HTTP Listener to be able to listen to a request with the content that I want to publish into the Solace Topic. Here you can see how I have configured the JMS Publish connector:

Anypoint Studio publish flow with HTTP Listener and JMS Publish to a Solace topic

Also, I have set the property SOLACE_JMS_PROP_DEAD_MSG_QUEUE_ELIGIBLE to true in the JMS Config Provider Properties.

JMS Config provider properties listing SOLACE_JMS_PROP_DEAD_MSG_QUEUE_ELIGIBLE

dev.yaml properties file with the Solace JMS config and dmqEligible set to "true"

5. Publishing the message from Postman

Postman POST to localhost:8081/publish returning 200 OK "published the message to Solace Topic"

Now the message is published to the Topic with ‘DMQ Eligible’ set to ‘Yes’. This message stays in the Queue test-queue-1 for 180 seconds before which it will be published to DMQ (test-queue-2) automatically for further processing.

test-queue-1 Messages Queued tab showing one message with DMQ Eligible Yes

test-queue-2 (the DMQ) Messages Queued tab showing the message after the TTL elapsed

Recap

Now we know how a delay in the processing of the messages can be achieved in Solace using the DMQ and TTL feature. Thanks for reading my post and I hope it will help!

That’s it for now! See you in the next post!

-Pravallika

FAQs

Frequently asked questions about this post.

  • What is a Dead Message Queue (DMQ) in Solace?

    A DMQ is a durable queue that messages are moved to instead of being discarded. By default, Guaranteed messages are removed from a durable endpoint and discarded when the number of redelivery attempts exceeds the Max Redelivery value, or when a message's Time-To-Live (TTL) value is exceeded and the endpoint respects message TTL expiry. If you don't want those messages discarded, you assign a DMQ to the endpoint so DMQ-eligible messages are sent there instead.

  • Why are my DMQ-eligible messages still being discarded?

    If an endpoint's assigned DMQ doesn't exist, the removed Guaranteed messages will still be discarded even if they are DMQ-eligible. By default each durable endpoint is assigned a DMQ named DEAD_MSG_QUEUE, but this queue does not pre-exist and must be created by a management user, so you need to make sure the DMQ actually exists.

  • How do I configure DMQ and TTL on a queue in Solace?

    In the advanced settings of the queue (in the post, test-queue-1) enable 'Respect TTL', set the 'Maximum TTL' (the post uses 180 seconds, which can be set based on your need), and set the 'DMQ Name' to the destination queue (the post uses test-queue-2). With this setting, whenever a message reaches test-queue-1 it stays there for 180 seconds before it's pushed to the DMQ test-queue-2.

  • How do I make a published message DMQ-eligible through the Mule JMS connector?

    First enable the 'Publisher Messages DMQ Eligible' property in the JMS JNDI of the Message VPN by going to JMS JNDI, then Connection Factories, then /jms/cf/default and enabling it. Then in the Mule app set the property SOLACE_JMS_PROP_DEAD_MSG_QUEUE_ELIGIBLE to true in the JMS Config Provider Properties, after which messages publish to the topic with 'DMQ Eligible' set to 'Yes'.

  • What happens to the message after the TTL elapses?

    Once published with DMQ Eligible set to Yes, the message stays in the queue test-queue-1 for 180 seconds, and before that TTL elapses it is automatically published to the DMQ (test-queue-2) for further processing rather than being discarded.

Search

Loading search…