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
Install
# Install the dependency
yum install python3
# Download the script from the RabbitMQ Server
wget http://{rabbitmq-server-hostname}:15672/cli/rabbitmqadmin
#
chmod 0755 rabbitmqadmin
mv rabbitmqadmin /usr/local/bin
rabbitmqadmin -h
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="{}"