NAME

Net::Async::AMQP::Channel - represents a single channel in an MQ connection

VERSION

Version 0.007

SYNOPSIS

use IO::Async::Loop;
use Net::Async::AMQP;
my $amqp = Net::Async::AMQP->new(loop => my $loop = IO::Async::Loop->new);
$amqp->connect(
  host => 'localhost',
  username => 'guest',
  password => 'guest',
  on_connected => sub {
  }
);

DESCRIPTION

METHODS

confirm_mode

Switches confirmation mode on for this channel. In confirm mode, all messages must be ACKed explicitly after delivery.

Returns a Future which will resolve with this channel once complete.

$ch->confirm_mode ==> $ch

exchange_declare

Declares a new exchange.

Returns a Future which will resolve with this channel once complete.

$ch->exchange_declare(
 exchange   => 'some_exchange',
 type       => 'fanout',
 autodelete => 1,
) ==> $ch

queue_declare

Returns a Future which will resolve with the new Net::Async::AMQP::Queue instance once complete.

$ch->queue_declare(
 queue      => 'some_queue',
) ==> $q

publish

Publishes a message on this channel.

Returns a Future which will resolve with the channel instance once the server has confirmed publishing is complete.

$ch->publish(
 exchange => 'some_exchange',
 routing_key => 'some.rkey.here',
 type => 'some_type',
) ==> $ch

qos

Changes QOS settings on the channel. Probably most useful for limiting the number of messages that can be delivered to us before we have to ACK/NAK to proceed.

Returns a Future which will resolve with the channel instance once the operation is complete.

$ch->qos(
 prefetch_count => 5,
 prefetch_size  => 1048576,
) ==> $ch

ack

Acknowledge a specific delivery.

Returns a Future which will resolve with the channel instance once the operation is complete.

$ch->ack(
 delivery_tag => 123,
) ==> $ch

Example output:

'method_id' => 40,
'reply_code' => 404,
'class_id' => 60,
'reply_text' => 'NOT_FOUND - no exchange \'invalidchan\' in vhost \'mv\''

on_close

Called when the channel has been closed.

send_frame

Proxy frame sending requests to the parent Net::Async::AMQP instance.

close

Ask the server to close this channel.

Returns a Future which will resolve with the channel instance once the operation is complete.

$ch->close(
 code => 404,
 text => 'something went wrong',
) ==> $ch

push_pending

remove_pending

Removes a coderef from the pending event handler.

Returns $self .

next_pending

Retrieves the next pending handler for the given incoming frame type (see "get_frame_type"), and calls it.

Takes the following parameters:

  • $type - the frame type, such as 'Basic::ConnectOk'

  • $frame - the frame itself

Returns $self.

METHODS - Accessors

amqp

The parent Net::Async::AMQP instance.

bus

Event bus. Used for sharing channel-specific events.

write

Proxy a write operation through the parent Net::Async::AMQP instance.

future

The underlying Future for this channel which will resolve to the instance once the channel is open.

id

This channel ID.

INHERITED METHODS

IO::Async::Notifier

add_child, adopt_future, can_event, children, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Licensed under the same terms as Perl itself.