langohr.queue
bind
(bind ch queue exchange)
(bind ch queue exchange {:keys [routing-key arguments], :or {routing-key "", arguments nil}})
Binds a queue to an exchange using queue.bind AMQP method
consumer-count
(consumer-count ch queue)
Returns a number of active consumers on the queue
declare
(declare ch)
(declare ch queue)
(declare ch queue {:keys [durable exclusive auto-delete arguments], :or {durable false, exclusive false, auto-delete true}})
Actively declare a server-named or named queue using queue.declare AMQP method.
Usage example:
;; declare server-named, exclusive, autodelete, non-durable queue.
(lhq/declare channel) ;; will return a map that contains the name: {:queue "amq.gen-QtE7OdDDjlHcxNGWuSoUb3"}
;; creates named non-durable, exclusive, autodelete queue
(lhq/declare channel queue-name {:durable false :exclusive true :auto-delete true})
Options
:durable (default: false): indicates wether the queue is durable. Durable queue will survive server restart. Durable queues do not neccessarily hold persistent messages. Using persistent messages with transient queues is allowed, but will not save messages between restarts.
:exclusive (default: false): when set to true, indicates that the queue is exclusive. No other subscriber can consume form that queue. Exclusive always implies auto-delete, as messages are delivered to the single consumer. When set to false, allows multiple consumers.
:auto-delete (default: true): when set to true, queue will be purged as soon as last consumer stops is finished using it. If consumer never got attached to the queue, it won't get deleted.
:arguments: other properties for the Queue.
declare-passive
(declare-passive ch queue)
Declares a queue passively (checks that it is there) using queue.declare AMQP method
declare-server-named
(declare-server-named ch)
(declare-server-named ch {:keys [durable exclusive auto-delete arguments], :or {durable false, exclusive false, auto-delete true}})
Declares a server-named queue and returns its name.
delete
(delete ch queue)
(delete ch queue if-unused if-empty)
Deletes a queue using queue.delete AMQP method
empty?
(empty? ch queue)
Returns true if queue is empty (has no messages ready), false otherwise
message-count
(message-count ch queue)
Returns a number of messages that are ready for delivery (e.g. not pending acknowledgements)
in the queue
purge
(purge ch queue)
Purges a queue using queue.purge AMQP method
status
(status ch queue)
Returns a map with two keys: message-count and :consumer-count, for the given queue.
Uses queue.declare AMQP method with the :passive attribute set.
unbind
(unbind ch queue exchange)
(unbind ch queue exchange routing-key)
(unbind ch queue exchange routing-key arguments)
Unbinds a queue from an exchange using queue.bind AMQP method