0

My requirement is to clear all the messages from queue(not delete the queue only purge the messages from queue) before processing the flow or publishing anything in the queue. We are using rabbitMQ and due to some reason messages are stucked in the queue and because of that we are facing some issue when we are counting the queue based on the messages. so for the next time before processing we have to clear the queue. Here we have multiple queue like slave1, slave2,slave3 and when api will be triggered in the process section we have to clear the queue. Mule 3 has a generic AMQP connector so i think we have to use http requester to do the same.

Kindly help to get the HTTP API to connect to rabbitMQ and do the purging. I have gone through some forum but not getting the clear idea. How do I delete all messages from a single queue using the CLI?

Devendra
  • 219
  • 2
  • 22

1 Answers1

0

If I understand correctly you need help to implement the same HTTP request that is performed using curl in the previous answers, but using Mule 3.

The answer shows how to use RabbitMQ management plugin's REST API to delete the contents of a queue:

curl -i -u guest:guest -XDELETE http://localhost:15672/api/queues/vhost_name/queue_name/contents

In Mule 3 something equivalent would be:

<http:request-config name="HTTP_Request_Configuration" host="httpbin.org" port="80" doc:name="HTTP Request Configuration" >
        <http:basic-authentication username="${user}" password="${password}"/>
</http:request-config>
<flow name="deleteQueueFlow">
    <http:request method="DELETE" doc:name="Request" config-ref="HTTP_Request_configuration" path="/api/queues/${vhostname}/${queuename}/contents"/>
</flow>
aled
  • 21,330
  • 3
  • 27
  • 34