Mojo::...Method(3pm)
πΈ NAME πΈ
okay so bestie, this is the manual page for Mojo::...Method(3pm) β the User Contributed Perl Documentation one β and the actual class is Mojo::RabbitMQ::Client::Method. it is literally the generic class for all AMQP method calls. no cap, thatβs the whole NAME section. π
β¨ SYNOPSIS β¨
hereβs the group-chat demo, copy it exactly:
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 the general class for every AMQP method call. itβs giving βone wrapper to rule them allβ energy, but for AMQP methods. π
π 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. so like, the reply you were waiting for pulls up, and this event says βhey bestie, we got it.β π«Ά
message
Can be emitted by consumption & get methods.
empty
Can be emitted by get method, when no messages are available on queue. itβs the βinbox zero but make it AMQPβ moment. πβ¨
π ATTRIBUTES π
Mojo::RabbitMQ::Client::Method has following attributes.
is_sent
$method->is_sent ? "Method was sent" : "Method is still pending delivery";
the ternary spells it out: "Method was sent" vs "Method is still pending delivery". very main character energy. π
client
my $client = $method->client;
$method->client($client);
getter/setter cuteness for the client. π
name
my $name = $method->name;
$method->name('Basic::Get');
getter/setter, and the example sets it to 'Basic::Get'. iconic. π
arguments
my $arguments = $method->arguments;
$method->arguments({no_ack => 1, ticket => 0, queue => 'amq.queue'});
getter/setter for the arguments hashref. the example is {no_ack => 1, ticket => 0, queue => 'amq.queue'}. π
expect
my $expectations = $method->expect;
$method->expect([qw(Basic::GetOk Basic::GetEmpty)]);
getter/setter for the expected replies. the example is [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. itβs the βletβs get this method configuredβ step. π
deliver
my $status = $method->deliver();
This delivers AMQP method call to server. Returns false when channel is not open, true otherwise. On successful delivery->reply cycle emits success event. error is emitted when none of expected replies are received. so yeah, ship it and watch the events do their thing. π
π 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.
and thatβs the whole page, bestie. this manual was rendered by perl v5.42.0 on 2019-08-25. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Mojo-RabbitMQ-Client 0.3.1-bp160.1.4 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms