1AMQP-CONSUME(1) RabbitMQ C Client AMQP-CONSUME(1)
2
3
4
6 amqp-consume - Consume messages from a queue on an AMQP server
7
9 amqp-consume [OPTION...] {command} [args...]
10
12 amqp-consume consumes messages from a queue on an AMQP server. For each
13 message that arrives, a receiving command is run, with the message body
14 supplied to it on standard input.
15
16 amqp-consume can consume from an existing queue, or it can create a new
17 queue. It can optionally bind the queue to an existing exchange.
18
19 By default, messages will be consumed with explicit acknowledgements. A
20 message will only be acknowledged if the receiving command exits
21 successfully (i.e. with an exit code of zero). The AMQP “no ack” mode
22 (a.k.a. auto-ack mode) can be enable with the -A option.
23
25 -q, --queue=queue name
26 The name of the queue to consume messages from.
27
28 If the --queue option is omitted, the AMQP server will assign a
29 unique name to the queue, and that server-assigned name will be
30 dixsplayed on stderr; this case implies that an exclusive queue
31 should be declared.
32
33 -e, --exchange=exchange name
34 Specifies that an exclusive queue should be declared, and bound to
35 the given exchange. The specified exchange should already exist
36 unless the --exchange-type option is used to request the creation
37 of an exchange.
38
39 -r, --routing-key=routing key
40 The routing key for binding. If omitted, an empty routing key is
41 assumed.
42
43 -d, --declare
44 Forces an exclusive queue to be declared, even when it otherwise
45 would not be. That is, when a queue name is specified with the
46 --queue option, but no binding to an exchange is requested with the
47 --exchange option. Note: this option is deprecated and may be
48 removed in a future version, use the --exclusive option to
49 explicitly declare an exclusive queue.
50
51 -x, --exclusive
52 Declared queues are non-exclusive by default, this option forces
53 declaration of exclusive queues.
54
55 -A, --no-ack=routing key
56 Enable “no ack” mode: The AMQP server will unconditionally
57 acknowledge each message that is delivered, regardless of whether
58 the target command exits successfully or not.
59
60 -c, --count=limit
61 Stop consuming after the given number of messages have been
62 received.
63
64 -p, --prefetch-count=limit
65 Request the server to only send limit messages at a time.
66
67 If any value was passed to --count, the value passed to
68 --prefetch-count should be smaller than that, or otherwise it will
69 be ignored.
70
71 If -A/--no-ack is passed, this option has no effect.
72
74 Consume messages from an existing queue “myqueue”, and output the
75 message bodies on standard output via cat:
76
77 $ amqp-publish -q myqueue cat
78
79 Bind a new exclusive queue to an exchange “myexch”, and send each
80 message body to the script myscript, automatically acknowledging them
81 on the server:
82
83 $ amqp-consume -A -e myexch ./myscript
84
86 librabbitmq-tools(7) describes connection-related options common to all
87 the RabbitMQ C Client tools.
88
90 The RabbitMQ Team <<info@rabbitmq.com>>
91
92
93
94RabbitMQ C Client 2021-04-01 AMQP-CONSUME(1)