How to move/delete messages with curl command?

2,655 views
Skip to first unread message

E. Anil Kumar

unread,
Aug 12, 2015, 9:52:55 AM8/12/15
to rabbitmq-users
I'm looking for a command to move/delete messages with curl.

Just like for creating a queue:

curl -i -u test:test -H "content-type:application/json" \
    -XPUT -d'{"type":"direct","durable":true}' \


How can i do like this for moving/deleting?
Thanks in Advance


Alvaro Videla

unread,
Aug 12, 2015, 10:40:24 AM8/12/15
to rabbitm...@googlegroups.com
There's no way to delete single messages from a RabbitMQ queue, unless you consume them and discard them.

To try that with curl, take a look at the method "/api/queues/vhost/name/get" here: https://cdn.rawgit.com/rabbitmq/rabbitmq-management/rabbitmq_v3_5_4/priv/www/api/index.html

You need to pass requeue = false

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alvaro Videla

unread,
Aug 12, 2015, 11:58:52 AM8/12/15
to E. Anil Kumar, rabbitm...@googlegroups.com
Hi,

Please keep rabbitmq-users CC'ed

If you want to do that on the admin page, then navigate to a queue page, and try to retrieve each message individually, with requeue = No




Cheers,

Alvaro



On Wed, Aug 12, 2015 at 5:52 PM, E. Anil Kumar <anilku...@gmail.com> wrote:

Hi,

Thanks for the reply.
But how can we delete the messages from RabbiMQ admin page??.

Here my requirement is not to do it from only curl, in any other possible way. But i want to delete the messages from the queue.

Please advice any way(s) to do this. I want to do it from my application.


Thanks
Anil


Anil

unread,
Aug 12, 2015, 12:07:10 PM8/12/15
to Alvaro Videla, rabbitm...@googlegroups.com
Hi,

Actually, I don't want to go to Rabbit Admin Page.

We have around 10 Rabbit servers and I'm creating a simple Application
to manage them from one web-page.

So far, I'm able to create and delete queues, thanks to Curl.

So I'm looking for a way to delete messages also.
Please Advice any way.

Thanks for the reply.

Regards
Anil.

On 8/12/15, Alvaro Videla <videl...@gmail.com> wrote:
> Hi,
>
> Please keep rabbitmq-users CC'ed
>
> If you want to do that on the admin page, then navigate to a queue page,
> and try to retrieve each message individually, with requeue = No
>
>
> ​
>

Laing, Michael

unread,
Aug 12, 2015, 12:42:42 PM8/12/15
to rabbitm...@googlegroups.com, Alvaro Videla
Perhaps you should use a dynamic shovel, which you can establish via the http API.

If you shovel to an exchange to which there is no binding, the messages will go away.

You can control how many messages are transferred.

You can have the shovel delete itself.

Anyway, might work for your purpose, as you expressed it.

ml

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send an email to rabbitm...@googlegroups.com.

Anil

unread,
Aug 13, 2015, 12:37:02 AM8/13/15
to rabbitm...@googlegroups.com, Alvaro Videla
Good idea Michael.
Thanks for the response. It is useful to me.

Is there any way to delete a queue through http API?



Thanks
Anil




--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/IS-3v4qNduw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

Anil

unread,
Aug 13, 2015, 2:54:51 AM8/13/15
to rabbitm...@googlegroups.com
Hi Michael,

I'm unable to call the HTTP API .
getting these errors.
Please help.

Command:
curl -i -u test:test -H "content-type:application/json" \
    -XPUT -d '{"value:{"src-uri":  "amqp://192.168.0.30","src-queue":  "output",
          "dest-uri": "amqp://192.168.0.30", "dest-queue": "responsemq"}}' http://localhost:15672/api/parameters/shovel/%2f/my-shovel123


Output:
{"error":"bad_request","reason":"not_json"}.






On Wed, Aug 12, 2015 at 10:12 PM, Laing, Michael <michae...@nytimes.com> wrote:

--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/IS-3v4qNduw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

Michael Klishin

unread,
Aug 13, 2015, 4:17:50 AM8/13/15
to rabbitm...@googlegroups.com, anilku...@gmail.com
The error message says it all. You use double quotes inside of double quotes in the request body, as far as I can see.

MK

Michael Klishin

unread,
Aug 13, 2015, 4:55:01 AM8/13/15
to rabbitm...@googlegroups.com, Anil
On 13 August 2015 at 07:37:03, Anil (anilku...@gmail.com) wrote:
> Is there any way to delete a queue through http API?

Yes, see HTTP API docs [1].

1. https://raw.githack.com/rabbitmq/rabbitmq-management/rabbitmq_v3_5_4/priv/www/api/index.html
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Michael Klishin

unread,
Aug 13, 2015, 7:35:56 AM8/13/15
to E. Anil Kumar, rabbitm...@googlegroups.com
+rabbitmq-users 

On 13 August 2015 at 14:34:28, E. Anil Kumar (anilku...@gmail.com) wrote:
> Yeah, That solved my problem.
>
> Thanks to One and all.. You made my job done.

Please CC the list.
Reply all
Reply to author
Forward
0 new messages