0
votes

I've multiple RabbitMQ Servers.

I need an interface(with JSP) where i can manage(delete queues/exchanges/messages) of all these servers .

Internally I'll call the curl commands to do the operations.

Example: To create queue

curl -i -u test:test -H "content-type:application/json" \
    -XPUT -d'{"type":"direct","durable":true}' \
    http://192.168.0.30:15672/api/queues/%2f/myQueue

How can i delete/move messages in a queue with curl?

3
Probably same question as here: groups.google.com/d/msg/rabbitmq-users/IS-3v4qNduw/oPseA7VxEgAJ with an answer on our mailing listold_sound
@old_sound. Yes.. It is the same question and is answered over thereAnil Kumar

3 Answers

2
votes

a shovel created with a curl will do the work :

curl 
-u  "user:password" 
-vvv 'http://localhost:15672/api/parameters/shovel/%2Foms/Move%20from%20sourceQueue' 
-X PUT 
-H 'content-type: application/json' 
--data-binary '
{
    "component": "shovel",
    "vhost": "/vhost",
    "name": "Move from sourceQueue",
    "value": {
        "src-uri": "amqp:///%2Fvhost",
        "src-queue": "sourceQueue",
        "src-protocol": "amqp091",
        "src-prefetch-count": 1000,
        "src-delete-after": "queue-length",
        "dest-protocol": "amqp091",
        "dest-uri": "amqp:///%2Fvhost",
        "dest-add-forward-headers": false,
        "ack-mode": "on-confirm",
        "dest-queue": "destQueue"
    }
}
' --compressed
0
votes

RabbitMQ does not have the concept of directly deleting messages off of a queue. There are many different ways to do the equivalent of "deleting" or "moving" messages from a queue when using RabbitMQ. Each of these options are available to you using the REST api. You can either consume messages off of a queue or you can expire messages from the queue.

Consuming messages from a queue is pretty simple, and there are examples here. To use expiry via Time To Live or Size of the queue you can set up a RabbitMQ policy. The documentation for RabbitMQ policies is here.