Mojo::RabbitMQ::Client::Method(3pm) | User Contributed Perl Documentation | Mojo::RabbitMQ::Client::Method(3pm) |
Mojo::RabbitMQ::Client::Method - it's a generic class for all AMQP method calls
use Mojo::RabbitMQ::Client::Method; my $method = Mojo::RabbitMQ::Client::Method->new( client => $client, channel => $channel )->setup( 'Basic::Consume' => { ... }, ['Basic::ConsumeOk', ...] ); # Watch for errors $method->on(error => sub { warn "Error in reception: " . $_[1] }); # Send this frame to AMQP $method->deliver;
Mojo::RabbitMQ::Client::Method is general class for every AMQP method call.
Mojo::RabbitMQ::Client::Method inherits all events from Mojo::EventEmitter and can emit the following new ones.
$method->on(success => sub { my ($method, $frame) = @_; ... });
Emitted when one of expected replies is received.
Can be emitted by consumption & get methods.
Can be emitted by get method, when no messages are available on queue.
Mojo::RabbitMQ::Client::Method has following attributes.
$method->is_sent ? "Method was sent" : "Method is still pending delivery";
my $client = $method->client; $method->client($client);
my $name = $method->name; $method->name('Basic::Get');
my $arguments = $method->arguments; $method->arguments({no_ack => 1, ticket => 0, queue => 'amq.queue'});
my $expectations = $method->expect; $method->expect([qw(Basic::GetOk Basic::GetEmpty)]);
Mojo::RabbitMQ::Client::Method inherits all methods from Mojo::EventEmitter and implements the following new ones.
$method = $method->setup($name, $arguments, $expectations);
Sets AMQP method name, its arguments and expected replies.
my $status = $method->deliver(); This delivers AMQP method call to server. Returns C<<false>> when channel is not open, C<<true>> otherwise. On successful delivery->reply cycle emits C<<success>> event. C<<error>> is emitted when none of expected replies are received.
Mojo::RabbitMQ::Client::Channel, Mojo::RabbitMQ::Client
Copyright (C) 2015-2017, Sebastian Podjasek and others
Based on AnyEvent::RabbitMQ - Copyright (C) 2010 Masahito Ikuta, maintained by "bobtfish@bobtfish.net"
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
2018-07-29 | perl v5.26.2 |