Reputation: 2751
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?
Upvotes: 0
Views: 3683
Reputation: 2149
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
Upvotes: 2
Reputation: 2751
The answer for my question is found at
https://groups.google.com/d/msg/rabbitmq-users/IS-3v4qNduw/oPseA7VxEgAJ
Upvotes: 1
Reputation: 317
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.
Upvotes: 0