Workflows are the center of message processing. It is very similar to the ASP.NET middleware pipeline.

With a workflow you can:

  • define what logic will be executed when a message arrives
  • execute an action before or after the actual execution
  • override or stop a workflow pipeline

Default workflows

By default, all messages are handled in an isolated fashion via ScopedMessageWorkflow using scopes. Once the scope is created then the next workflow (MessageHandleWorkflow) is invoked with the current message and scope. In addition, DiagnosticsWorkflow wraps the entire pipeline bringing insights into the performance of the message handling pipeline.


The primary focus of the workflow is to prepare an isolated scope and context within which a message is being processed. Usually, you should not interact with this workflow directly.

The workflow creates an instance of IServiceScope which allows using Dependency Injection in a familiar to a dotnet developer way. In addition, the workflow initializes an instance of CronusContext which holds information about the current tenant handling the message.

Additionally, Cronus uses structured logging and a new log scope is created every time a new message arrives so you could co-relate log messages.

{% hint style="info" %} Read more about the Dependency Injection and service lifetimes if this is a new concept for you. {% endhint %}


TODO: Explain message handling workflow responsibilities