Amqpx.Basic.consume
You're seeing just the function
consume
, go back to Amqpx.Basic module for more information.
Link to this function
consume(chan, queue, consumer_pid, options \\ [])
Specs
Registers a queue consumer process. The pid
of the process can be set using
the consumer_pid
argument and defaults to the calling process.
The consumer process will receive the following data structures:
{:basic_deliver, payload, meta}
- This is sent for each message consumed, wherepayload
contains the message content andmeta
contains all the metadata set when sending with Basic.publish or additional info set by the broker;{:basic_consume_ok, %{consumer_tag: consumer_tag}}
- Sent when the consumer process is registered with Basic.consume. The caller receives the same information as the return of Basic.consume;{:basic_cancel, %{consumer_tag: consumer_tag, no_wait: no_wait}}
- Sent by the broker when the consumer is unexpectedly cancelled (such as after a queue deletion){:basic_cancel_ok, %{consumer_tag: consumer_tag}}
- Sent to the consumer process after a call to Basic.cancel
Options
:consumer_tag
- Specifies the consumer tag for this consumer (as a string). This tag is local to the given channelchan
, so different channels can have consumers that use the same consumer tag. If the given consumer tag is""
, then the server autogenerates the tag. Defaults to""
.:no_local
- If set, the server won't send messages to the connection that published them. Defaults tofalse
.:no_ack
- If set, the server will not expect message acks from the consumer and will consider every message that it believes was delivered to the consumer as acknowledged. Defaults tofalse
, meaning that messages need to be acked explicitly throughack/3
.:exclusive
- If set, requests exclusive consumer access, meaning that only this consumer can consume from the givenqueue
. Note that the client cannot have exclusive access to a queue that already has consumers.:no_wait
- If set, the consume operation is asynchronous. Defaults tofalse
.:arguments
- A list of arguments to pass when consuming (of typeAmqpx.arguments/0
). See the README for more information. Defaults to[]
.