ipolevoy
ipolevoy

Reputation: 5518

Apache Artemis: How to move JMS messages to a different queue

The new version of Artemis removed the class JMSQueueControl and all classes associated with it.

Our project uses the JMS API to send/receive/listen, as well as manage. We need to manage the queues, including moving messages from one queue to another by JMS message ID, which a GUID type of a String.

The new version of Artemis 2.2.0 has a QueueControl#moveMessage(long), which, apparently operates on an internal message ID (not the JMS message ID).

The question is: How to move messages from one queue to another using JMS message ID in Artemis version 2.X ?

Upvotes: 4

Views: 3098

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 34988

You can use the management method:

org.apache.activemq.artemis.api.core.management.QueueControl#moveMessages(java.lang.String, java.lang.String)

It takes a "filter" as the first parameter. You can use the filter:

AMQUserID='<jmsMessageId>'

  • AMQUserID: This refers to an ID set by the user. In this case, it's the JMS message ID (i.e. an ID set by the JMS client). It doesn't refer to security credentials.
  • <jmsMessageId>: This is the message ID of the JMS message you want to move. This is what JMSQueueControl did behind the scenes in the first place.

To be clear, after adding support for AMQP, STOMP, and MQTT the JMSQueueControl (as well as all other JMS-specific management & configuration classes) was pulled out because it no longer made sense to have separate JMS-specific ways of doing the same things already offered by the core management API.

Upvotes: 5

Related Questions