Dave Rolsky > Crixa > Crixa::Exchange

Download:
Crixa-0.10.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.10   Source  

NAME ^

Crixa::Exchange - A Crixa Exchange

VERSION ^

version 0.10

DESCRIPTION ^

This class represents a single exchange. With RabbitMQ, messages are published to an exchange. Queues can then connect to exchanges and receive those messages.

METHODS ^

This class provides the following methods:

Crixa::Exchange->new

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

$exchange->publish(...)

This method sends a message to the exchange. It accepts either a hash or hashref with the following keys:

Note that if you publish a message and there is no queue bound to the exchange which can receive that message, the message will be discarded. This means you must create your exchanges and queues before you publish any messages..

$exchange->queue(...)

This returns a new Crixa::Queue object. This method accepts all of the arguments that can be passed to the Crixa::Queue constructor, either as a hash or hashref. See the Crixa::Queue documentation for more details.

In addition, it also accepts a routing_keys parameter, which should be an arrayref of strings. If these are provided, then the queue is bound to the exchange with each string in the arrayref as a routing key.

This is a convenient way of declaring and binding a queue all at once.

$exchange->delete(...)

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

$exchange->name(...)

This returns the exchange name as passed to the constructor.

$exchange->channel

Returns the Crixa::Channel that this exchange uses.

$exchange->exchange_type

This returns the exchange type as passed to the constructor or set by a default.

$exchange->passive

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

$exchange->durable

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

$exchange->auto_delete

This returns the auto-delete 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: