NAME
POE::Component::Client::AMQP::Queue - AMQP Queue object
DESCRIPTION
Create using the POE::Component::Client::AMQP::Channel objects' queue()
command. Calling queue()
also retrieves previously created Queue objects. Alternatively, you can use the create()
class method below to create it directly, but doing so will not send the Queue.Declare call to the AMQP server.
CLASS METHODS
create (...)
Pass two named args 'name' (optional) and 'channel'.
OBJECT METHODS
name
Returns the queue name
channel
Returns the POE::Component::Client::AMQP::Channel parent object.
is_created
Returns a boolean, indicating wether the queue has been created on the AMQP server yet or not.
do_when_created (...)
See POE::Component::Client::AMQP::do_when_startup(); similar behavior.
subscribe ($subref, \%opts)
Sends a Net::AMQP::Protocol::Basic::Consume frame to the server, storing the $subref as a callback function for when content is received.
Optionally provide %opts which will override defaults for the Basic.Consume call.
The argument signature of the callback is like so:
my $do_ack = $subref->($message, $meta)
- $do_ack
-
If in the %opts hash you choose 'no_ack => 0', then messages have to be explicitly ack'ed once handled. If your callback returns true in this condition, an ack message will automatically be sent for you.
- $message
-
Opaque payload of the content body.
- $meta
-
Hashref with keys as follows:
- method_frame
-
Net::AMQP::Protocol::Base delivering method object.
- header_frame
-
Net::AMQP::Frame::Header object
- weight, body_size
-
Copied from the header_frame object.
- payload
-
Same as the $message argument above.
- body_frames
-
Array of all the Net::AMQP::Frame::Body frames that comprise the payload.
- queue
-
The name of this queue object.
- opts
-
The options used to create the Basic.Consume call (merge of default values and %opts, above)
publish ($message, \%opts)
Sends a message to the queue. In other words, sends a Net::AMQP::Protocol::Basic::Publish followed by a Net::AMQP::Protocol::Basic::ContentHeader and Net::AMQP::Frame::Body containing the body of the message.
Optionally pass %opts, which can override any option in the Net::AMQP::Protocol::Basic::Publish ('ticket', 'exchange', 'routing_key', 'mandatory', 'immediate'), Net::AMQP::Frame::Header ('weight') or Net::AMQP::Protocol::Basic::ContentHeader ('content_type', 'content_encoding', 'headers', 'delivery_mode', 'priority', 'correlation_id', 'reply_to', 'expiration', 'message_id', 'timestamp', 'type', 'user_id', 'app_id', 'cluster_id') objects. See the related documentation for an explaination of each.
SEE ALSO
POE::Component::Client::AMQP::Channel
COPYRIGHT
Copyright (c) 2009 Eric Waters and XMission LLC (http://www.xmission.com/). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
AUTHOR
Eric Waters <ewaters@gmail.com>