4

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 ?

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
ipolevoy
  • 5,432
  • 2
  • 31
  • 46

1 Answers1

4

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.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • this makes sense, I will try later and let you know. – ipolevoy Aug 25 '17 at 18:09
  • Upvoted your answer as correct - much appreciated. Any idea why the decision was made to pull the JMSQueueControl out? This made the upgrade to version 2.2.0 very painful for us (besides the fact that journal format changed too!) – ipolevoy Aug 26 '17 at 22:04
  • also, while the is working now, it looks really strange, because a user ID is not a message id :) – ipolevoy Aug 26 '17 at 22:10
  • Thanks for clarification, makes sense. – ipolevoy Sep 01 '17 at 16:27