Alexander Hartmaier > Message-Passing-AMQP > Message::Passing::Output::AMQP

Download:
Message-Passing-AMQP-0.007.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Source  

NAME ^

Message::Passing::Output::AMQP - output messages to AMQP.

SYNOPSIS ^

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

DESCRIPTION ^

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.

SEE ALSO ^

Message::Passing::AMQP
Message::Passing::Input::AMQP
Message::Passing
AMQP
http://www.zeromq.org/

AUTHOR, COPYRIGHT AND LICENSE ^

See Message::Passing::AMQP.

syntax highlighting: