Rabbit v0.1.0 Rabbit.Message View Source

A message consumed by a Rabbit.Consumer.

After starting a consumer, any message passed to the Rabbit.Consumer.handle_message/1 callback will be wrapped in a messsage struct. The struct has the following fields:

  • :consumer - The PID of the consumer process.
  • :module - The module of the consumer process.
  • :channel - The AMQP.Channel being used by the consumer.
  • :payload - The raw payload of the message.
  • :decoded_payload - If the message has a content type - this will be the payload decoded using the applicable serializer.
  • :meta - The metadata sent when publishing or set by the broker.
  • :error_reason - The reason for any error that occurs during the message handling callback.
  • :error_stack - The stacktrace that might accompany the error.

Link to this section Summary

Link to this section Types

Link to this type

t() View Source
t() :: %Rabbit.Message{
  channel: AMQP.Channel.t(),
  consumer: pid(),
  decoded_payload: any(),
  error_reason: any(),
  error_stack: nil | list(),
  meta: map(),
  module: module(),
  payload: binary()
}

Link to this section Functions

Link to this function

new(consumer, module, channel, payload, meta) View Source

Creates a new message struct.