2

I am using RabbitMQ in my java application.

I want to move messages from 1 queue to another queue.

The answer that i found here is helpful for me Is it possible to move / merge messages between RabbitMQ queues?.

But on running that command, there's no success or failure message.

How can i ensure this during runtime? The command I am using

rabbitmqctl set_parameter shovel my-shovel '{"src-uri": "amqp://localhost", "src-queue": "myQueue", \
 "dest-uri": "amqp://localhost", "dest-queue": "test3"}'

And the output

Setting runtime parameter "my-shovel" for component "shovel" to "{\"src-uri\": \"amqp://localhost\", \"src-queue\": \"myQueue\", \"dest-uri\": \"amqp://localhost\", \"dest-queue\": \"test3\"}" ...

Community
  • 1
  • 1
Anil Kumar
  • 2,521
  • 7
  • 23
  • 40
  • does your shovel add-on active? Also do you need to do that one time only? Or you intent to do this all the time? – bhdrkn Jul 23 '15 at 17:30
  • I need to do this many times. Yes Shovel is active – Anil Kumar Jul 24 '15 at 05:25
  • Do you using Exchanges? You can bind multiple queue to same exchange. Than whenever a new message came to your exchange it will routed automatically to both queues. – bhdrkn Jul 24 '15 at 05:53
  • @bhdrkn I'm providing an interface on top of RabbitMQ. If there's any problem with a queue q1, i want to move the messages to q2. – Anil Kumar Jul 24 '15 at 06:02
  • What do you mean by "problem with a queue"? If you have a erroneous messages, when you get exception on your client side it automatically pushed back to same queue. But you can easily catch those exception and push it to a different queue. – bhdrkn Jul 24 '15 at 06:09
  • By the way, as far as i know you cannot execute a shovel from client side. Because of that I am trying to understand your root problem. Again, if you try to direct messages when an error occur, you may also want to check [dead-letter-exchange](https://www.rabbitmq.com/dlx.html). – bhdrkn Jul 24 '15 at 06:20
  • @bhrkdn, thanks it is helpful – Anil Kumar Jul 24 '15 at 09:24

2 Answers2

2

Another way to do this is to set a RabbitMQ policy for Time To Live or Size on the Queue. Then, setup up a policy to handle where the messages should go. This will expire the messages out of the first queue and send them to the second queue. The reference for how to do this is here and here.

joshuad2
  • 309
  • 1
  • 4
0

If you have the rabbitmq_shovel_management plugin enabled, you can view the configured shovels and their status in the web-management console under the ADMIN tab.

froeschli
  • 2,692
  • 2
  • 28
  • 55