Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save baybatu/36aef24681e751277ecc9f4efb53eb4e to your computer and use it in GitHub Desktop.
Save baybatu/36aef24681e751277ecc9f4efb53eb4e to your computer and use it in GitHub Desktop.
Create RabbitMQ queue and exchange with binding using REST API
# create exchange
curl -i -u guest:guest -H "content-type:application/json" \
-XPUT -d'{"type":"fanout","durable":true}' \
http://localhost:15672/api/exchanges/%2f/my.exchange.name
# create queue
curl -i -u guest:guest -H "content-type:application/json" \
-XPUT -d'{"durable":true,"arguments":{"x-dead-letter-exchange":"", "x-dead-letter-routing-key": "my.queue.dead-letter"}}' \
http://localhost:15672/api/queues/%2f/my.queue
# create queue related dead letter queue
curl -i -u guest:guest -H "content-type:application/json" \
-XPUT -d'{"durable":true,"arguments":{}}' \
http://localhost:15672/api/queues/%2f/my.queue.dead-letter
# create binding
curl -i -u guest:guest -H "content-type:application/json" \
-XPOST -d'{"routing_key":"","arguments":{}}' \
http://localhost:15672/api/bindings/%2f/e/my.exchange/q/my.queue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment