AMQP-CONSUME(1)

πŸ’– NAME πŸ’–

amqp-consume β€” the tool that eats messages off a queue on an AMQP server, bestie. She pulls them in and hands them straight to your command. Iconic behavior, honestly.


✨ SYNOPSIS ✨

amqp-consume [OPTION...] {command} [args...]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so. amqp-consume consumes messages from a queue on an AMQP server. For each message that shows up, a receiving command gets run, and the message body is handed to it on standard input. That's the whole vibe. food delivery but the food is bytes πŸ“

She can consume from a queue that already exists, OR she can create a brand new queue for you. And if you want, she can bind that queue to an existing exchange. lowkey a full-service queen πŸ‘‘

By default, messages get consumed with explicit acknowledgements. Meaning: a message is only acknowledged if the receiving command exits successfully β€” i.e. with an exit code of zero. If your command face-plants, no ack for you, sweetie. The AMQP "no ack" mode (a.k.a. auto-ack mode) can be turned on with the -A option, if you're feeling reckless πŸ’…


πŸŽ€ OPTIONS πŸŽ€

  • -q, --queue=queue name β€” the name of the queue you're consuming messages from.

If you leave --queue out entirely, the AMQP server itself will assign a unique name to the queue, and that server-assigned name gets displayed on stderr. Heads up though: this case implies that an exclusive queue should be declared.

  • -e, --exchange=exchange name β€” says that an exclusive queue should be declared, and bound to the given exchange. That exchange should already exist, unless you're using the --exchange-type option to request that an exchange be created.
  • -r, --routing-key=routing key β€” the routing key for binding. If you skip it, an empty routing key is assumed.
  • -d, --declare β€” forces an exclusive queue to be declared, even when it otherwise wouldn't be. Like, when a queue name is given with the --queue option but no binding to an exchange is requested with the --exchange option.
⚠️ note note note: this option is deprecated and may get removed in a future version. use the --exclusive option to explicitly declare an exclusive queue instead. don't get attached πŸ₯²
  • -x, --exclusive β€” declared queues are non-exclusive by default, so this option forces declaration of exclusive queues.
  • -A, --no-ack=routing key β€” enables "no ack" mode: the AMQP server will unconditionally acknowledge every single message that gets delivered, regardless of whether the target command exits successfully or not. zero thoughts, just vibes 😭
  • -c, --count=limit β€” stop consuming after the given number of messages have been received.
  • -p, --prefetch-count=limit β€” request the server to only send limit messages at a time.

If any value was passed to --count, the value passed to --prefetch-count should be smaller than that β€” otherwise it gets ignored. perks of being the smaller number i guess πŸ’€

If -A/--no-ack is passed, this option has no effect.


🌸 EXAMPLES 🌸

Consume messages from an existing queue "myqueue", and output the message bodies on standard output via cat:

$ amqp-consume -q myqueue cat

Bind a new exclusive queue to an exchange "myexch", and send each message body to the script myscript, automatically acknowledging them on the server:

$ amqp-consume -A -e myexch ./myscript

πŸ”₯ SEE ALSO πŸ”₯

librabbitmq-tools(7) describes connection-related options common to all the RabbitMQ C Client tools. go read it, iykyk 🫢


πŸ‘‘ AUTHOR πŸ‘‘

The RabbitMQ Team <info@rabbitmq.com>


and that's the tea, bestie 🧚 this was the RabbitMQ C Client manual, dated 2026-10-13. slay, go consume some messages responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from