The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Crixa::Message - A Crixa Message

VERSION

version 0.11

DESCRIPTION

This class represents a single queue. With RabbitMQ, messages are published to exchanges, which then routes the message to one or more queues. You then consume those messages from the queue.

METHODS

This class provides the following methods:

$message->ack

This send an acknowledgement for the message on the channel that was used to receive the message.

$message->body

This returns the message's body. If the message does not have any content-encoding set _or_ the message contains an encoding with the string "utf-8" (case insensitive), then the message is returned as character data. Otherwise it is returned as binary data.

Property methods

There are a number of properties that can be associated with a message. This class provides reader and predicate methods for all properties of the form $message->foo and $message->has_foo. None of the properties are required.

The properties supported are:

  • content_type

  • content_encoding

  • correlation_id

  • reply_to

  • expiration

  • message_id

  • type

  • user_id

  • app_id

  • priority

  • delivery_mode

  • timestamp

  • headers

See the publish method in the Crixa::Exchange docs for more details.

$message->redelivered

A boolean indicating whether or not the message has already been delivered at least once. RabbitMQ guarantees that each message will be delivered at least once, and it is not uncommon for a message to be redelivered before the first consumer to receive it has had a chance to acknowledge it.

$message->message_count

The number of messages left in the queue at the time this message was delivered.

Note that this is only set for messages which are not received via the Crixa::Queue->consume() method.

$message->routing_key

The routing path on which the message was received.

$message->exchange

The exchange to which this message was published

$message->delivery_tag

The delivery tag for a given message. This is used when the $message->ack() method is called.

$message->consumer_tag

The tag for the consumer associated with the message, if one exists.

Note that this is only set for messages which are received via the Crixa::Queue->consume() method.

Crixa::Message->new(...)

There is no reason to call this method directly. It will be called by a Crixa::Queue object to inflate messages into objects.

AUTHORS

  • Chris Prather <chris@prather.org>

  • Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 - 2015 by Chris Prather.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.