Workflows are the center of the 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
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 about 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 to use 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.
TODO: Explain message handling workflow responsibilities