Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RabbitMQ (AMQP)

Publishes to or consumes from a RabbitMQ queue over the AMQP 0-9-1 protocol.

URL format

rabbitmq://[user:pass@]host[:port]/<vhost>?queue=<name>

amqp:///amqps:// (the native AMQP scheme) and rabbitmq:/// rabbitmqs:// (an alias) are both accepted; rabbitmq(s) is rewritten to amqp(s) before being handed to the driver. The default vhost / must be percent-encoded as %2f in the URL path, per the AMQP URI spec.

Examples

Consume a queue and forward each message to an HTTP endpoint, continuous:

mq-bridge-app copy \
  --from rabbitmq://guest:guest@localhost:5672/%2f?queue=orders \
  --to http://internal-api.local/ingest?method=POST

Publish to an exchange instead of a default-exchange queue:

mq-bridge-app copy --drain \
  --from file:///data/events.jsonl?format=json \
  --to 'amqp://guest:guest@localhost:5672/%2f?exchange=events&queue=events'

Fan-out subscriber mode (ephemeral queue bound to the exchange):

mq-bridge-app copy \
  --from 'amqp://guest:guest@localhost:5672/%2f?exchange=events&subscribe_mode=true' \
  --to kafka://kafka.local:9092?topic=events

Key options

OptionPurpose
queueQueue to consume from / publish to.
exchangeExchange to publish to or bind the queue to.
subscribe_modeConsumer-only: fan-out (ephemeral queue) instead of point-to-point.
prefetch_countConsumer-only: messages to prefetch. Defaults to 100.
no_persistenceNon-durable queues / non-persistent messages.

Full field list: reference/rabbitmq.md.