Message::Passing::Output::AMQP(3pm)

Message::Passing::Output::AMQP3pm

Output messages to amqp.

Usage

    message-pass --input STDIN --output AMQP --output_options '{"exchange_name":"test","hostname":"127.0.0.1","username":"guest","password":"guest"}'

Overview

A Message::Passing AnyEvent::RabbitMQ output class.

Can be used as part of a chain of classes with the message-pass utility, or directly as a logger in normal perl applications.

Attributes

routing_key

The routing key for all messages, defaults to ''.

header_cb

Optional callback function which gets passed the message before it is serialized using "serialize_cb". Should return a hashref which gets passed to publish( header => ).

NOTE: if you want to set the message headers (note the s) you have to pass them inside headers, e.g.:

  {
      content_type => 'application/json',
      headers => {
          key => 'value',
      }
  }

serialize_cb

Optional callback function which gets passed the message and should return a scalar. This is useful when passing structured messages e.g. hashrefs or objects where some attributes should be accessible for the "header_cb" function. If the serialization happens before using a Message::Passing::Role::Filter it would require to deserialize it again in header_cb. To use a Message::Passing filter you can instantiate it and pass it's filter function to serialize_cb:

  my $filter = Message::Passing::Filter::Encoder::JSON->new(output_to => undef);
  ...
  {
      serialize_cb => sub { $filter->filter(shift) },
  }

Methods

consume

Sends a message.

Releases

6 releases since Debian 8 (Jessie); the text changed 3 times.

  1. 8
  2. 9
  3. 10–11
  4. 12–13

From libmessage-passing-amqp-perl 0.008-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.