|
NAMEMojo::RabbitMQ::Client::Method - it's a generic class for all AMQP method callsSYNOPSISuse 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; DESCRIPTIONMojo::RabbitMQ::Client::Method is general class for every AMQP method call.EVENTSMojo::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. messageCan be emitted by consumption & get methods.emptyCan be emitted by get method, when no messages are available on queue.ATTRIBUTESMojo::RabbitMQ::Client::Method has following attributes.is_sent$method->is_sent ? "Method was sent" : "Method is still pending delivery"; clientmy $client = $method->client; $method->client($client); namemy $name = $method->name; $method->name('Basic::Get'); argumentsmy $arguments = $method->arguments; $method->arguments({no_ack => 1, ticket => 0, queue => 'amq.queue'}); expectmy $expectations = $method->expect; $method->expect([qw(Basic::GetOk Basic::GetEmpty)]); METHODSMojo::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. delivermy $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 ALSOMojo::RabbitMQ::Client::Channel, Mojo::RabbitMQ::ClientCOPYRIGHT AND LICENSECopyright (C) 2015-2017, Sebastian Podjasek and othersBased 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.
Visit the GSP FreeBSD Man Page Interface. |