Messag...::AMQP(3pm)
β¨ Message::Passing::Output::AMQP β¨
okay bestie, listen π this is a page from the User Contributed Perl Documentation collection, and it's literally about yeeting your messages into AMQP. come sit with me, we're doing this together π«Ά
NAME π
Message::Passing::Output::AMQP β output messages to AMQP. that's it, that's the vibe, that's the whole job description π
SYNOPSIS β¨
like, here's the whole thing in one iconic little line:
message-pass --input STDIN --output AMQP --output_options '{"exchange_name":"test","hostname":"127.0.0.1","username":"guest","password":"guest"}'
see how cute that is? STDIN goes in, AMQP comes out, and all the connection deets ride along inside --output_options. slay.
DESCRIPTION π¦
so this is a Message::Passing output class built on top of AnyEvent::RabbitMQ β that's the whole personality π
you can run it two ways, and honestly both are valid:
- as one link in a whole chain of classes with the
message-passutility (the group-chat option, everyone's in the chat) - or directly, as a logger inside your normal everyday perl applications (the solo main-character option π)
ATTRIBUTES π
these are the lil knobs you can turn. get comfy.
routing_key
the routing key for every single message, no exceptions, no favourites. it defaults to '' β empty string, yes, that's the default, that's canon.
header_cb
an optional callback function β¨ it gets handed the message before it's serialized using serialize_cb. it should return a hashref, and that hashref gets passed to publish( header => ).
β οΈ NOTE bestie this is the important bit: if you want to set the message headers (note the s, plural, there's an s!!) you have to pass them inside headers, like this:
{
content_type => 'application/json',
headers => {
key => 'value',
}
}
see the headers inside the headers situation? nested. it's giving inception π don't fight it.
serialize_cb
another optional callback function π«Ά this one gets passed the message and should return a scalar. it's the moment for turning stuff into bytes basically.
it's super useful when you're passing structured messages β think hashrefs or objects β where some of those attributes need to stay reachable for the header_cb function. because listen: if the serialization already happened before a Message::Passing::Role::Filter did its thing, then header_cb would have to deserialize it all over again and nobody has time for that π
so if you wanna use a Message::Passing filter, you instantiate it and hand its filter function straight to serialize_cb, like so:
my $filter = Message::Passing::Filter::Encoder::JSON->new(output_to => undef);
...
{
serialize_cb => sub { $filter->filter(shift) },
}
obsessed. ate. no crumbs. π₯
METHODS π
consume
sends a message. that's the whole method. short, sweet, does exactly what it says on the tin π
SEE ALSO πΈ
go read these next, bestie, iykyk:
Message::Passing::AMQPMessage::Passing::Input::AMQPMessage::PassingAMQP- <http://www.zeromq.org/>
AUTHOR, COPYRIGHT AND LICENSE π
see Message::Passing::AMQP β yeah, that's literally where it all lives, go look π
k bye ily, this was the perl v5.36.0 era, dated 2022-11-19, from your friendly neighborhood Messag...::AMQP(3pm) page πβ¨π stay hydrated and always pass your messages correctly π¦
π¦ where this page comes from
- debian bookworm: libmessage-passing-amqp-perl 0.008-2 Β· LGPL-2.1-only
- debian trixie: libmessage-passing-amqp-perl 0.008-2 Β· LGPL-2.1-only
- ubuntu noble: libmessage-passing-amqp-perl 0.008-2 Β· LGPL-2.1-only
- ubuntu resolute: libmessage-passing-amqp-perl 0.008-2 Β· LGPL-2.1-only
- ubuntu stonking: libmessage-passing-amqp-perl 0.008-2 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms