Skip to main content

Development with RabbitMQ

Publishing Message

bash

curl

curl -u login:pass -i -H "content-type:application/json" -X POST http://localhost:15672/api/exchanges/%2Fvhost/exchange/publish \
 -d'{"properties":{},"routing_key":"","payload":"you message","payload_encoding":"string"}'

rabbitmqadmin

while read -r line; do 
echo $line | rabbitmqadmin publish exchange=amq.default routing_key=my_queue ;
done < messages

rabbitmqadmin publish exchange=amq.default routing_key=test payload="hello, world"

# With parallel
cat messages | parallel -j 100 \
./rabbitmqadmin -H $RABBITMQ_HOST \
-u $RABBITMQ_USERNAME \
-p $RABBITMQ_PASSWORD \
publish exchange=amq.default \
routing_key=myqueue \
payload="{}"