amqp v0.3.1 AMQP.Queue View Source
Functions to operate on Queues.
Link to this section Summary
Functions
Binds a Queue to an Exchange
Returns a number of active consumers on the queue
Declares a queue. The optional queue
parameter is used to set the name.
If set to an empty string (default), the server will assign a name
Deletes a Queue by name
Returns true if queue is empty (has no messages ready), false otherwise
Returns the number of messages that are ready for delivery (e.g. not pending acknowledgements) in the queue
Discards all messages in the Queue
Returns the message count and consumer count for the given queue.
Uses Queue.declare with the passive
option set
Convenience to consume messages from a Queue
Unbinds a Queue from an Exchange
Convenience to end a Queue consumer
Link to this section Functions
bind(AMQP.Channel.t, String.t, String.t, keyword) :: :ok
Binds a Queue to an Exchange
consumer_count(AMQP.Channel.t, String.t) :: integer
Returns a number of active consumers on the queue
declare(AMQP.Channel.t, String.t, keyword) :: {:ok, map}
Declares a queue. The optional queue
parameter is used to set the name.
If set to an empty string (default), the server will assign a name.
Besides the queue name, the following options can be used:
Options
:durable
- If set, keeps the Queue between restarts of the broker:auto_delete
- If set, deletes the Queue once all subscribers disconnect:exclusive
- If set, only one subscriber can consume from the Queue:passive
- If set, raises an error unless the queue already exists
delete(AMQP.Channel.t, String.t, keyword) :: {:ok, map}
Deletes a Queue by name
empty?(AMQP.Channel.t, String.t) :: boolean
Returns true if queue is empty (has no messages ready), false otherwise
message_count(AMQP.Channel.t, String.t) :: integer
Returns the number of messages that are ready for delivery (e.g. not pending acknowledgements) in the queue
purge(AMQP.Channel.t, String.t) :: {:ok, map}
Discards all messages in the Queue
status(AMQP.Channel.t, String.t) :: {:ok, map}
Returns the message count and consumer count for the given queue.
Uses Queue.declare with the passive
option set.
subscribe(AMQP.Channel.t, String.t, (String.t, map -> any)) :: {:ok, String.t}
Convenience to consume messages from a Queue.
The handler function must have arity 2 and will receive as arguments a binary with the message payload and a Map with the message properties.
The consumed message will be acknowledged after executing the handler function. If an exception is raised by the handler function, the message is rejected.
This convenience function will spawn a process and register it using AMQP.Basic.consume.
unbind(AMQP.Channel.t, String.t, String.t, keyword) :: :ok
Unbinds a Queue from an Exchange
unsubscribe(AMQP.Channel.t, String.t) :: {:ok, String.t}
Convenience to end a Queue consumer.