Message::Passing(3pm)
π Message::Passing π
okay bestie, sit DOWN, because this is Message::Passing from the User Contributed Perl Documentation, and it's literally a whole vibe. β¨
πΈ NAME πΈ
Message::Passing β a simple way of doing messaging. that's it. that's the name. short, sweet, iconic. π
π¦ SYNOPSIS π¦
message-pass --input STDIN --output STDOUT
{"foo": "bar"}
{"foo":"bar"}
like. that's the whole thing. you pass a message. it passes. slay. β¨
π DESCRIPTION π
so Message::Passing is a library for building high performance, loosely coupled and reliable/resilient applications, structured as small services which communicate over the network by passing messages. no cap. π«Ά
π« BASIC PREMISE π«
okay so here's the tea. you have data for discrete events, represented by a hash (and serialized as JSON).
this could be a text log line, an audit record of an API event, a metric emitted from your application that you wish to aggregate and process β anything that can be a simple hash really.. (yes the double period is in the original and yes i'm keeping it, it's giving dramatic pause π)
you want to be able to shove these events over the network easily, and aggregate them / filter and rewrite them / split them into worker queues.
this module is designed as a simple framework for writing components that let you do all of these things, in a simple and easily extensible manor. (that's manor, not manner, and we are not fixing it, we are respecting the author's choices π)
for a practical example, You generate events from a source (e.g. ZeroMQ output of logs and performance metrics from your Catalyst FCGI or Starman workers) and run one script that will give you a central application log file, or push the logs into Elasticsearch. honestly? main character energy. π₯
there are a growing set of components you can plug together to make your solution. it's giving lego but for logs.
getting started is really easy β you can just use the message-pass command installed by the distribution. if you have a common config that you want to repeat, or you want to write your own server which does something more flexible than the normal script allows, then see Message::Passing::DSL.
to dive straight in, see the documentation for the command line utility message-pass, and see the examples in Message::Passing::Manual::Cookbook.
for more about how the system works, see Message::Passing::Manual::Concepts.
π COMPONENTS π
below is a non-exhaustive list of components available. so like, there are more. this is a starter pack. π
π INPUTS π
inputs receive data from a source (usually a network protocol).
they are responsible for decoding the data into a hash before passing it onto the next stage. so they do the translating bestie, they speak network so you don't have to π«Ά
inputs include:
Message::Passing::Input::STDINMessage::Passing::Input::ZeroMQMessage::Passing::Input::STOMPMessage::Passing::Input::AMQPMessage::Passing::Input::SyslogMessage::Passing::Input::RedisMessage::Passing::Input::Test
you can easily write your own input, just use AnyEvent, and consume Message::Passing::Role::Input. DIY queen behavior β¨
π§ FILTER π§
filters can transform a message in any way. anything. go feral.
examples include:
Message::Passing::Filter::Nullβ Returns the input unchanged.Message::Passing::Filter::Allβ Stops any messages it receives from being passed to the output. I.e. literally filters all input out.Message::Passing::Filter::Tβ Splits the incoming message to multiple outputs.
you can easily write your own filter, just consume Message::Passing::Role::Filter.
note that filters can be chained, and a filter can returnundefto stop a message being passed to the output. so yeah, returningundefis the vibe check that nobody passes π
π OUTPUTS π
outputs send data to somewhere, i.e. they consume messages. they're the ones actually eating π
Message::Passing::Output::STDOUTMessage::Passing::Output::AMQPMessage::Passing::Output::STOMPMessage::Passing::Output::ZeroMQMessage::Passing::Output::WebHooksMessage::Passing::Output::Search::ElasticsearchMessage::Passing::Output::RedisMessage::Passing::Output::Test
π SEE ALSO π
Message::Passing::Manualβ The manual (contributions cherished). cherished!! they said cherished!! π₯Ί<http://www.slideshare.net/bobtfish/messaging-interoperability-and-log-aggregation-a-new-framework>β Slide deck!Log::Message::Structuredβ For creating your log messages.Log::Dispatch::Message::Passingβ useMessage::Passingoutputs fromLog::Dispatch.
π THIS MODULE π
this is a simple MooX::Options script, with one input, one filter and one output. the holy trinity. the trio. the girl group. π
to build your own similar scripts, see:
Message::Passing::DSLβ To declare your message chains.Message::Passing::Role::CLIComponentβ To provide"foo"and"foo_options"attribute pairs.Message::Passing::Role::Scriptβ To provide daemonization features.
β METHODS β
build_chainβ Builds and returns the configured chain of input => filter => output. it constructs the whole little assembly line, iconic.startβ Class method to call therun_message_serverfunction with the results of having constructed an instance of this class, parsed command line options and constructed a chain.
This is the entry point for the script. the front door. the main character entrance. πͺβ¨
π AUTHOR π
Tomas (t0m) Doran <bobtfish@bobtfish.net>
π«Ά SUPPORT π«Ά
π Bugs
Please log bugs at rt.cpan.org. Each distribution has a bug tracker link in its metacpan.org page.
π¬ Discussion
#message-passing on irc.perl.org.
π¦ Source code
Source code for all modules is available at <http://github.com/suretec> and forks/patches are very welcome. come thru, contribute, we love to see it π
π° SPONSORSHIP π°
This module exists due to the wonderful people at Suretec Systems Ltd. <http://www.suretecsystems.com/> who sponsored its development for its VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with the SureVoIP API β <http://www.surevoip.co.uk/support/wiki/api_documentation>
shoutout to the sponsors, they funded the whole thing, absolute legends π
Β©οΈ COPYRIGHT Β©οΈ
Copyright Suretec Systems Ltd. 2012.
Logstash (upon which many ideas for this project are based, but from which we do not reuse any code) is copyright 2010 Jorden Sissel.
π LICENSE π
GNU Library General Public License, Version 2.1
and that's the whole page bestie π this was Message::Passing (3pm), from perl v5.32.1, dated 2021-11-09. go forth, pass some messages, be resilient, stay loosely coupled. periodt. πβ¨π¦
π¦ where this page comes from
- debian bookworm: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- debian trixie: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- ubuntu jammy: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- ubuntu noble: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- ubuntu resolute: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms