Microservice Framework based on Durable Task Framework. A nuget package is available.
The Durable Task Framework is an open source project originally started by Microsoft. It enables you to write orchestrations in pure C# using the .Net framework. By using of this framework, you can implement many kinds of integration projects without of need to use any Enterprise Service Bus product.
Here are the key features of the durable task framework:
- Definition of code orchestrations in simple C# code
- Automatic persistence and check-pointing of program state
- Versioning of orchestrations and activities
- Async timers, orchestration composition, user aided checkpoints
The framework itself is very light weight and only requires an Azure Service Bus namespace and optionally an Azure Storage account. Running instances of the orchestration and worker nodes are completely hosted by the user. The framework uses a scheduler on top of Azure Service Bus (hosted in Cloud or OnPrem) and it is completely transparent to developer. Developers is not ever required to have any Service Bus know-how.
You can find a good introduction about DTF in following articles
The DurableTaskMicroservices allows you to serialize/deserialize (save/load) orchestrations and tasks.
The idea of DurableTaskMicroservices is to split the host and orchestration/task code. The host loads the assemblies of the orchestrations/tasks and their configuration files. This allows to change running orchestrations without changing the host code, just by replacing the assemblies and the configuration.
- host and orchestrations decoupling
- client and host decoupling
- dynamic loading of orchestrations (with configuration)
This repository contains multiple hosts, you can decide which host fits best to your needs. You are free to implement your own host and contribute it via pull request. For more information about hosting, please take a look on this article
This topic explains how the host loads the orchestration assemblies and the configuration.
-
The WindowsServiceHost searches for all
*.config.xml
files in the working directory. These files must contain your XML serializedMicroservice
. For more information about configuration please see: Configuration -
Now WindowsServiceHost gets all Types which are used in the
Microservices
. To do this, the host gets all *.dlls in the working folder and check for the existence ofIntegrationAssemblyAttribute
. -
Then the host starts the
TaskHubWorker
and create anOrchestrationInstance
(if none are running).
A simple windows service used to host the DurableTaskFramework.
The installation process is quite simple. First you should compile the WindowsServiceHost solution and copy the output into the deployment folder (you should create one).
To install the windows service, just run the Scripts/installservice.ps1
.
The PowerShell script will guide you trough the install process.
To uninstall the windows service, just run the Scripts/uninstallservice.ps1
.
This library extends the Durable Task Framework with base classes for Orchestrations, Tasks. Furthermore it includes general reusable Tasks and Adapters for SQL and FileSystems.
A nuget package is available.
There are several BaseClasses, they extend the DurableTask Framework.
OrchestrationBase
inherits TaskOrchestration
and adds base Logging functionality to an Orchestration.
This includes:
- Logging Scope with ActivityId
- Logging Scope with OrchestrationInstanceId
TaskBase
inherits TaskActivity
and extends it with following features:
- LogManager initialization (Logging Scopes)
- Exception logging in case of Task execution throws an exception.
Adapters are used to send/receive data from any source to a different source.
ReceiveAdapterBase
makes writing adapters for receiving data easier.
Features:
- build-in method
executeValidationRules
executes all given (implemented by user)ValidationRuleDescriptor
ReceiveAdapterBase
makes writing adapters for sending data easier.
It is implemented as an abstract class with a SendData
method the user has to implement.
The Daenet.DurableTaskMicroservices.Common
package includes several ready-to-use Tasks.
The DelayTask
delays the execution by using Thread.Sleep
.
The LoggingTask
allows you to Log a messages.
LoggingTask
uses LogManager internal.