Workflows

https://github.com/Elders/Cronus/issues/266arrow-up-right

Workflows are the center of message processing. It is very similar to the ASP.NET middleware pipelinearrow-up-right.

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 ScopedMessageWorkflowarrow-up-right using scopes. Once the scope is created then the next workflow (MessageHandleWorkflowarrow-up-right) is invoked with the current message and scope. In addition, DiagnosticsWorkflowarrow-up-right wraps the entire pipeline bringing insights into the performance of the message handling pipeline.

ScopedMessageWorkflow

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 IServiceScopearrow-up-right which allows using Dependency Injection in a familiar to a dotnet developer way. In addition, the workflow initializes an instance of CronusContextarrow-up-right 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.

circle-info

Read more about the Dependency Injectionarrow-up-right and service lifetimesarrow-up-right if this is a new concept for you.

MessageHandleWorkflow

TODO: Explain message handling workflow responsibilities

Last updated

Was this helpful?