user1166031
user1166031

Reputation: 268

Moving messages between queues

Is there a IBM MQ JAVA API to move messages from one queue to another?

I am able to browse messages from the queue and put messages as well using Java APIs. But I want to move a message from one queue to another. Could you please give a sample code if there is any?

Or do we have to dequeue the message from queue1 and then put the message into queue2 for moving the messages?

Upvotes: 0

Views: 4002

Answers (2)

user5173252
user5173252

Reputation: 9

I have faced the same issue and after lot of frustrating hours i have done it using tool "MQJExplorer_v0.16". Using this tool you can export/import all the messages(or a single message) from one queue to another queue.

If you are facing any issues while installation. Please make sure you are using the correct jdk version (I faced the same issue). You can check the java version in the MetaInf file of one of the downloaded artifacts, make sure you have the same jdk or newer version on your localmachine and just set the JAVA_HOME in the environment variables.

Upvotes: 0

Aravind Yarram
Aravind Yarram

Reputation: 80166

You need to GET from queue 1 and then do a PUT on queue 2. If you just browse then there are chances that before yoy GET it out of queue 1, the consumer have already consumed it using GET. You can find sample code for many scenarios on this website.

Upvotes: 1

Related Questions