ExRabbitMQAdmin.Queue (ex_rabbitmq_admin v0.1.4)
View SourceThis module contains functions for interacting with RabbitMQ queues.
Summary
Functions
Delete an existing queue under a virtual host.
Get an individual queue under a virtual host by name.
List all bindings for a queue under a virtual host.
List all queues running on the RabbitMQ cluster.
List all queues in a given virtual host running on the RabbitMQ cluster.
Perform an action on a queue.
Purge all messages on a queue under a virtual host.
Create a new queue under a virtual host.
Receive messages from a queue under a virtual host. Please not that this is not an optimal way to consume messages from a queue. Consider using a library like AMQP.
Functions
@spec delete_queue( client :: Tesla.Client.t(), vhost :: String.t(), queue :: String.t(), params :: Keyword.t() ) :: {:ok, Tesla.Env.t()} | no_return()
Delete an existing queue under a virtual host.
Params
client
- Tesla client used to perform the request.vhost
- type:string
, Virtual host for the queue.queue
- type:string
, Name of the queue to delete.:if_empty
(boolean/0
) - If true, prevent deleting the queue if it contains any messages. This option is not supported byquorum
queues.:if_unused
(boolean/0
) - If true, prevent deleting the queue if it has any consumers. This option is not supported byquorum
queues.
@spec get_queue(client :: Tesla.Client.t(), vhost :: String.t(), queue :: String.t()) :: {:ok, Tesla.Env.t()} | {:error, term()}
Get an individual queue under a virtual host by name.
Params
client
- Tesla client used to perform the request.vhost
- type:string
, Virtual host for the queue.queue
- type:string
, Name of the queue to get.
@spec list_queue_bindings( client :: Tesla.Client.t(), vhost :: String.t(), queue :: String.t() ) :: {:ok, Tesla.Env.t()} | {:error, term()}
List all bindings for a queue under a virtual host.
Params
client
- Tesla client used to perform the request.vhost
- type:string
, Virtual host for the queue.queue
- type:string
, Name of the queue to get bindings for.
@spec list_queues(client :: Tesla.Client.t(), opts :: Keyword.t()) :: {:ok, Tesla.Env.t()} | no_return()
List all queues running on the RabbitMQ cluster.
Params
client
- Tesla client used to perform the request.:page
(non_neg_integer/0
) - Page number to fetch if paginating the results.:page_size
(non_neg_integer/0
) - Number of elements per page, defaults to 100.:name
(String.t/0
) - Filter by name, for example queue name, exchange name, etc.:use_regex
(boolean/0
) - Enables regular expression for the paramname
.
@spec list_vhost_queues( client :: Tesla.Client.t(), vhost :: String.t(), opts :: Keyword.t() ) :: {:ok, Tesla.Env.t()} | no_return()
List all queues in a given virtual host running on the RabbitMQ cluster.
Params
client
- Tesla client used to perform the request.vhost
- Name of the virtual host.:page
(non_neg_integer/0
) - Page number to fetch if paginating the results.:page_size
(non_neg_integer/0
) - Number of elements per page, defaults to 100.:name
(String.t/0
) - Filter by name, for example queue name, exchange name, etc.:use_regex
(boolean/0
) - Enables regular expression for the paramname
.
@spec perform_queue_action( client :: Tesla.Client.t(), vhost :: String.t(), queue :: String.t(), action :: :sync | :cancel_sync ) :: {:ok, Tesla.Env.t()} | {:error, term()}
Perform an action on a queue.
Params
client
- Tesla client used to perform the request.vhost
- type:string
, Virtual host for the queue.queue
- type:string
, Name of the queue to perform actions for.action
- type:atom
, Action to perform. Currently only supports:sync
and:cancel_sync
@spec purge_queue( client :: Tesla.Client.t(), vhost :: String.t(), queue :: String.t() ) :: {:ok, Tesla.Env.t()} | {:error, term()}
Purge all messages on a queue under a virtual host.
Params
client
- Tesla client used to perform the request.vhost
- type:string
, Virtual host for the queue.queue
- type:string
, Name of the queue to purge messages from.
@spec put_queue( client :: Tesla.Client.t(), vhost :: String.t(), queue :: String.t(), opts :: Keyword.t() ) :: {:ok, Tesla.Env.t()} | no_return()
Create a new queue under a virtual host.
Params
client
- Tesla client used to perform the request.vhost
- type:string
, Virtual host for the queue.queue
- type:string
, Name of the queue to get.:auto_delete
(boolean/0
) - If true, automatically delete the queue when the last consumer disconnects. The default value isfalse
.:durable
(boolean/0
) - If true, messages are persisted on disk. This can lead to lower throughput, but better data consistency. The default value istrue
.:node
(String.t/0
) - If set, start the queue on given node name.:arguments
(map ofString.t/0
keys andterm/0
values) - Optional queue arguments (x-arguments) passed to RabbitMQ when creating the queue. Please consult the official documentation for supported arguments (as they vary for queue type and installed plugins).
@spec receive_queue_messages( client :: Tesla.Client.t(), vhost :: String.t(), queue :: String.t(), opts :: Keyword.t() ) :: {:ok, Tesla.Env.t()} | no_return()
Receive messages from a queue under a virtual host. Please not that this is not an optimal way to consume messages from a queue. Consider using a library like AMQP.
Params
client
- Tesla client used to perform the request.vhost
- type:string
, Virtual host for the queue.queue
- type:string
, Name of the queue to receive messages from.:count
(pos_integer/0
) - Maximum number of messages to receive. You may get fewer messages if the queue cannot immediately provide them. The default value is1
.:ackmode
- Required. Determines if the messages will be removed from the queue. If set toack_requeue_true
orreject_requeue_true
, the messages will be re-queued. If set toack_requeue_false
, orreject_requeue_false
, they will be removed.:encoding
- If set toauto
, message payload will be returned as string if it is valid UTF-8, or base64 encoded otherwise. If set tobase64
message payload will always be base64 encoded. The default value is:auto
.:truncate
(pos_integer/0
) - If present, truncate the message payload if larger than given size (in bytes).