- COPYRIGHT AND LICENSE
Crixa::Channel - A Crixa Channel
This class represents a channel. A channel is a lot like a socket. You will probably want to have a unique channel per process or thread for your application. You may also want to have separate channels for publishing and consuming messages.
It is safe (and encouraged) to keep the same channel open over a long period of time for publishing or consuming messages. There is no need to create new channels on a regular basis.
Also note that message delivery tags are scoped to the channel on which a message is delivered, and therefore message acks must go back to that same channel.
Channels are created by calling the
This class provides the following methods:
This method creates a new Crixa::Exchange object. Any parameters passed to this method are passed directly to the Crixa::Exchange constructor, either as a hash or hashref. See the Crixa::Exchange documentation for more details.
This method creates a new Crixa::Queue object. Any parameters passed to this method are passed directly to the Crixa::Queue constructor, either as a hash or hashref. See the Crixa::Queue documentation for more details.
This method sets quality of service flags for the channel. This method takes a hash or hash reference with the following keys:
prefetch_count => $count
If this is set, then the channel will fetch
$countadditional messages to the client when it is consuming messages, rather than sending them down the socket one at a time.
prefetch_size => $size
Set the maximum number of bytes that will be prefetched. If both this and
prefetch_countare set then the smaller of the two wins.
global => $bool
If this is true, then the QoS settings apply to all consumers on this channel. If it is false, then it only applies to new consumers created after this is set.
In Crixa, a new AMQP consumer is created whenever you call any methods to get messages on a Crixa::Queue object, so this setting doesn't really matter.
Note that prefetching messages is only done when the queue is created in "no ack" mode (or "auto ack" if you prefer to think of it that way).
This method acknowledges delivery of a message received on this channel.
It accepts two positional arguments. The first is the delivery tag for the message, which is required. The second is the "multiple" flag. If this is true, it means that you are acknowledging all messages up to the given delivery tag. It defaults to false.
This returns the channel's unique id. This is a positive integer.
Don't call this method directly. Instead, call
new_channel on a connected Crixa object.
Chris Prather <firstname.lastname@example.org>
Dave Rolsky <email@example.com>
This software is copyright (c) 2012 - 2015 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.