# `Kombu.Message`
[🔗](https://github.com/hacktobeer/kombu/blob/v0.1.0/lib/kombu/message.ex#L1)

Base class for received messages (`kombu.message.Message` and `kombu.transport.virtual.base.Message`).

# `t`

```elixir
@type t() :: %Kombu.Message{
  accept: [String.t()] | MapSet.t() | nil,
  body: binary() | term() | nil,
  channel: Kombu.Channel.t() | nil,
  content_encoding: String.t() | nil,
  content_type: String.t() | nil,
  decoded_cache: {:cached, term()} | nil,
  delivery_info: map(),
  delivery_tag: String.t() | integer() | nil,
  errors: [Exception.t()],
  headers: map(),
  postencode: String.t() | nil,
  properties: map(),
  raw_message: map() | nil,
  state: String.t()
}
```

# `ack`

```elixir
@spec ack(t(), keyword()) :: t()
```

Acknowledges the message (`Message.ack`) and returns the updated `%Kombu.Message{state: "ACK"}`.
Raises `Kombu.MessageStateError` if the message is not bound to a channel or is already acknowledged.

# `ack_log_error`

```elixir
@spec ack_log_error(t(), [module()], keyword()) :: t()
```

Acknowledges the message, logging any errors matching `errors` instead of raising.

# `acknowledged?`

```elixir
@spec acknowledged?(t()) :: boolean()
```

Returns `true` if the message has been acknowledged, rejected, or requeued.

# `decode`

```elixir
@spec decode(t()) :: term()
```

Deserializes the message body according to its `content_type`, `content_encoding`, and `accept` list.

# `decode_body`

```elixir
@spec decode_body(term(), String.t() | nil) :: term()
```

Decodes a message body according to `body_encoding` (`"base64"` or `nil` / `"string"`).

# `decode_cached`

```elixir
@spec decode_cached(t()) :: {term(), t()}
```

Deserializes the message body and caches the result on the returned struct.

# `encode_body`

```elixir
@spec encode_body(term(), String.t() | nil) :: term()
```

Encodes a message body according to `body_encoding` (`"base64"` or `nil` / `"string"`).

# `new`

```elixir
@spec new(keyword() | map(), Kombu.Channel.t() | keyword() | nil) :: t()
```

Creates a new `%Kombu.Message{}` from keyword options or from a raw virtual transport
message map (`new(raw_message_map, channel)`).

# `payload`

```elixir
@spec payload(t()) :: term()
```

Returns the deserialized message payload (`Message.payload`).

# `reject`

```elixir
@spec reject(t(), keyword()) :: t()
```

Rejects the message (`Message.reject`) and returns `%Kombu.Message{state: "REJECTED"}`.

# `reject_log_error`

```elixir
@spec reject_log_error(t(), [module()], keyword()) :: t()
```

Rejects the message, logging any errors matching `errors` instead of raising.

# `requeue`

```elixir
@spec requeue(t()) :: t()
```

Rejects and requeues the message (`Message.requeue`), returning `%Kombu.Message{state: "REQUEUED"}`.

# `reraise_error!`

```elixir
@spec reraise_error!(t(), (Exception.t() -&gt; any()) | nil) :: :ok
```

Reraises the first error encountered during message initialization (such as decompression failure),
or invokes `callback.(err)` if provided.

# `serializable`

```elixir
@spec serializable(t()) :: map()
```

Converts a virtual-transport message back into its serializable envelope map
(`kombu.transport.virtual.base.Message.serializable`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
