Dave Rolsky > Crixa > Crixa::Queue

Download:
Crixa-0.10.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.10   Source  

NAME ^

Crixa::Queue - A Crixa Queue

VERSION ^

version 0.10

DESCRIPTION ^

This class represents a single queue. With RabbitMQ, messages are published to exchanges, which then routes the message to one or more queues. You then consume those messages from the queue.

METHODS ^

This class provides the following methods:

Crixa::Queue->new(...)

This method creates a new queue object. You should not call this method directly under normal circumstances. Instead, you should create a queue by calling the queue method on a Crixa::Channel or Crixa::Exchange object. However, you need to know what parameters the constructor accepts.

$queue->check_for_message(...)

This checks the queue for a message. This method does not block. It returns undef if there is no message ready. It accepts either a hash or hashref with the following keys:

no_ack => $bool

If this is true, then the message is not acknowledged as it is taken from the queue. You will need to explicitly acknowledge it using the ack method on the Crixa::Channel object from which the message came.

If this is false, then the message is acknowledged immediately. Calling the ack method later with this message's delivery tag will be an error.

This defaults to true.

$queue->wait_for_message(...)

This blocks until a message is ready. It always returns a single message.

This takes the same parameters as the check_for_message method.

$queue->handle_message($callback, ...)

This message takes a callback and blocks until the next message. It calls the callback with the message as its only argument and returns whatever the callback returns.

This takes the same parameters as the check_for_message method after the callback.

$queue->message_count

Returns the number of messages waiting in the queue.

$queue->bind(...)

This binds a queue to an exchange. It accepts either a hash or hashref with the following keys:

$queue->delete(...)

This deletes the queue. It accepts either a hash or hashref with the following keys:

$queue->name

Returns the queue name.

$queue->channel

Returns the Crixa::Channel that this queue uses.

$queue->passive

This returns the passive flag as passed to the constructor or set by a default.

$queue->durable

This returns the durable flag as passed to the constructor or set by a default.

$queue->auto_delete

This returns the auto-delete flag as passed to the constructor or set by a default.

$queue->exclusive

This returns the exclusive flag as passed to the constructor or set by a default.

AUTHORS ^

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 - 2014 by Chris Prather.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: