This project is part of the MessageHandler processing patterns library.
MessageHandler is distributed under a commercial license, for more information on the terms and conditions refer to our license page.
A downstream activity executes a command by directly changing the state of the system.
Use this pattern every time a command needs to result in an immediate state change of the system.
Examples include performing a software configuration update, or changing the state of an IoT actuator such as a relay or step motor.
In this scenario you will send a changeconsolecolor
command remotely, through an API, to instruct the Worker process to change its output color.
Any color represented by the ConsoleColor enum is supported.
Note: the logging infrastructure has its own color coding and won't follow the change
- The .NET 6 SDK should be installed
- The sample was created using Visual Studio 2022 community edition.
- To receive events an azure service bus namespace is used.
- The MessageHandler.Runtime.AtomicProcessing package is available from nuget.org
Prior to running the sample, you need to configure the user secrets file.
In the secrets file you must specify the following configuration values.
{
"servicebusnamespace": "your azure service bus connection string goes here",
}
Also ensure a queue named control
is created in the service bus namespace.
Once configured you can start the API & Worker, or run the unittests.
MessageHandler is intented to be test friendly.
This sample contains plenty of ideas on how to test a downstream activity without requiring a dependency on an actual broker instance, and thus keep the tests fast.
- Component tests: To test the activity logic and it's interaction with the email service.
- Contract tests: To verify that the test doubles used in the component tests are behaving the same as an actual dependency would. Note: contract verification files are often shared between producers and consumers of the contract.
Check out this how to guide to learn how to configure a downstream activity yourself.