Skip to content

Message attributes ​

Attributes are metadata sent alongside a message. This page explains where they travel and what kinds there are.

When a transport such as RabbitMQ or Amazon SQS sends a message, it wraps it in an envelope. Commands and events are serialized into the body, and attributes go in its headers. Use attributes for technical concerns, such as routing the message, or for auditing and logging, such as who or what sent it.

Handlers receive the attributes as their second argument, a MessageAttributes with three parts:

attributes and stickyAttributes are always objects in a handler, even when the sender didn't set any, so read them without ?.. Values can be strings, numbers or booleans.

See also ​

Released under the MIT License.