Provided by: libmojo-rabbitmq-client-perl_0.3.1-3_all
NAME
Mojo::RabbitMQ::Client::Method - it's a generic class for all AMQP method calls
SYNOPSIS
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;
DESCRIPTION
Mojo::RabbitMQ::Client::Method is general class for every AMQP method call.
EVENTS
Mojo::RabbitMQ::Client::Method inherits all events from Mojo::EventEmitter and can emit the following new ones. success $method->on(success => sub { my ($method, $frame) = @_; ... }); Emitted when one of expected replies is received. message Can be emitted by consumption & get methods. empty Can be emitted by get method, when no messages are available on queue.
ATTRIBUTES
Mojo::RabbitMQ::Client::Method has following attributes. is_sent $method->is_sent ? "Method was sent" : "Method is still pending delivery"; client my $client = $method->client; $method->client($client); name my $name = $method->name; $method->name('Basic::Get'); arguments my $arguments = $method->arguments; $method->arguments({no_ack => 1, ticket => 0, queue => 'amq.queue'}); expect my $expectations = $method->expect; $method->expect([qw(Basic::GetOk Basic::GetEmpty)]);
METHODS
Mojo::RabbitMQ::Client::Method inherits all methods from Mojo::EventEmitter and implements the following new ones. setup $method = $method->setup($name, $arguments, $expectations); Sets AMQP method name, its arguments and expected replies. deliver 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.
SEE ALSO
Mojo::RabbitMQ::Client::Channel, Mojo::RabbitMQ::Client
COPYRIGHT AND LICENSE
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.