---
name: "Message::Passing::Output::AMQP"
section: "3pm"
platform: "linux"
package: "libmessage-passing-amqp-perl"
version: "0.008-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Message::Passing::Output::AMQP"
---

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

output messages to AMQP.

## 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.
