Skip to content
Mogens Heller Grabe edited this page Jan 13, 2021 · 5 revisions

Since message dispatch is such an important part of Rebus, I think it's fair to dedicate a page to explain how it happens... here goes 🙂

What is it?

Message dispatch is what happens when a Rebus endpoint receives a message - and message in this case is a transport message. A transport message is a serialized thing that has headers and a body.

The headers are simply string-based key-value pairs, and the body will by default be a UTF8-encoded JSON-serialized .NET object with full type information.

Handling a transport message

Upon receiving a transport message, Rebus will simply get its incoming pipeline and pass the message to it. After successful execution of the pipeline, the transaction context that spans the receive operation is completed.

All the interesting stuff happens inside the pipeline :)

By default, pipeline steps will be present that

  • wraps the execution of the rest of the pipeline in an error-tracker
  • deserializes the transport message
  • looks up relevant message handlers
  • loads/saves relevant saga data
  • actually calls the message handler(s)

which does most of the work when handling an ordinary incoming message.

Depending on your configuration, other pipeline steps may be present - e.g. one that can filter and forward incoming messages, one that can save deferred messages for later, etc.

It can often be a good idea to log the contents of the pipelines to see the effect of the chosen configuration.

Clone this wiki locally