0

Let's say I have two queues i.e. queue1 and queue2. I have messages in queue1 which I stored in a JSON file by using the following command.

curl -u user:pass -H "content-type:application/json" -XPOST http://192.168.178.23:15672/api/queues/testvhost/queue1/get -d'{"count":5,"ackmode":"ack_requeue_true","encoding":"auto","truncate":50000}' -o m1.json

with the help of this post:- RabbitMQ - Get messages from a queue using curl

My JSON file looks like this:- https://paste-me.net/fibed

I am trying to push this JSON file (messages) to another queue queue2 with the help of the following command:

curl -i -u user:pass -H "Accept: application/json" -H "Content-Type:application/json" -X POST -d @m1.json http://192.168.178.23:15672/api/exchanges/testvhost/queue2/publish

HTTP/1.1 500 Internal Server Error
content-length: 0

But it seems to be not working.

Any help will be appreciated and please don't suggest to me an idea about the shovel.

ThankYou.

1 Answer 1

0

Based on documentation, in order to publish a message using HTTP, the body should look like this:

{"properties":{},"routing_key":"my key","payload":"my body","payload_encoding":"string"}

But you are sending an array of messages, which seems to be not supported in the API (as it states it expects a single message with these fields).

enter image description here

https://raw.githack.com/rabbitmq/rabbitmq-management/rabbitmq_v3_6_9/priv/www/api/index.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.