Skip to content

Wire level format of messages

Mogens Heller Grabe edited this page Jan 26, 2014 · 11 revisions

A Rebus message contains the following two things:

  • message headers - list of key/value pairs
  • message body - sequence of 0..* logical messages

This page will describe the two on a general level - you can read more about the concrete details on the page of each of the supported transports: MSMQ transport, RabbitMQ transport, Azure Service Bus transport.

Message headers

Rebus message headers should be moved in a way that makes them visible to the outside (if possible), allowing them to be used to contain various metadata about the message, which turns out can be used for various conveninent purposes.

If the transport has a mechanism for transferring headers, that mechanism should be used (if not for all headers, then at least in a way that makes relevant headers visible to applications and tools that don't necessarily know anything about Rebus).

Rebus has a number of special headers that carry with them special semantics, and these will be used by Rebus to e.g. implement the ability to reply back to the sender of a message, etc. All special Rebus headers are prefixed with rebus-, e.g. rebus-correlation-id to denote the automatically-flowing correlation ID that can be used to track cause and effect in your endpoints.

All the special Rebus headers are described in more detail in the code.

You can of course attach your own custom headers to messages (by using the bus.AttachHeader(...) method), thus allowing you to pass your own metadata along with messages. Many of the special Rebus headers can be set as well (e.g. rebus-return-address, in order to have the reply sent to another endpoint than the requestor), but you should be careful to test that you get the expected behavior.

Clone this wiki locally