class AMQP::Client::Queue

Overview

High-level representation of a Queue

Example:

client = AMQP::Client.new.connect
ch = client.channel
q = ch.queue("foobar")
q.bind("amq.fanout", "")
q.subscribe do |msg|
  puts msg.body_io
end

Defined in:

amqp-client/queue.cr

Instance Method Summary

Instance Method Detail

def bind(exchange : String, routing_key : String, no_wait = false, args arguments = Arguments.new) #

Bind the queue to an exchange


[View source]
def consumer_count #

Check number of consumers of the queue


[View source]
def delete(if_unused = false, if_empty = false) #

Delete the queue

See Channel#queue_delete


[View source]
def get(no_ack = true) #

Poll the queue for a message

See Channel#basic_get


[View source]
def message_count #

Check number of messages in the queue


[View source]
def name : String #

Name of the queue


[View source]
def publish(io : IO, bytesize : Int, mandatory = false, immediate = false, props properties = Properties.new) #

Publish a message directly to the queue


[View source]
def publish(message, mandatory = false, immediate = false, props properties = Properties.new) #

Publish a message directly to the queue


[View source]
def publish(io : IO, bytesize : Int, mandatory = false, immediate = false, props properties = Properties.new, &blk : Bool -> Nil) #

Publish a message directly to the queue, block is called when message is confirmed


[View source]
def publish(message, mandatory = false, immediate = false, props properties = Properties.new, &blk : Bool -> Nil) #

Publish a message directly to the queue, block is called when message is confirmed


[View source]
def publish_confirm(io : IO, bytesize : Int, mandatory = false, immediate = false, props properties = Properties.new) #

Publish and confirm a message directly to the queue


[View source]
def publish_confirm(message, mandatory = false, immediate = false, props properties = Properties.new) #

Publish and confirm a message directly to the queue


[View source]
def purge #

Purge the queue

See Channel#queue_purge


[View source]
def subscribe(tag = "", no_ack = true, exclusive = false, block = false, args arguments = Arguments.new, work_pool = 1, &blk : DeliverMessage -> Nil) #

Consume messages from the queue

See Channel#basic_consume


[View source]
def unbind(exchange : String, routing_key : String, args arguments = Arguments.new) #

Unbind the queue from an exchange


[View source]
def unsubscribe(consumer_tag, no_wait = true) #

Unsubscribe from the queue

See Channel#basic_cancel for more details


[View source]