From 83dc168951b9d4e9d70ea5ef9482320f8caa6442 Mon Sep 17 00:00:00 2001 From: "Simon A. Eugster" Date: Wed, 14 Apr 2021 11:09:46 +0200 Subject: [PATCH 1/4] Add components overview --- docs/architecture.md | 16 ++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 17 insertions(+) create mode 100644 docs/architecture.md diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 000000000..66314840c --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,16 @@ +# Workflow Core Architecture + +**Host** manages the workflows. Workflows are registered and started here. +The host also provides error and lifecycle events. + +**Registry** contains the workflow definitions with their steps + +**Persistence** persists the workflow states with its execution pointers + +**Execution Pointer** is created when a step is visited during a workflow. +Fields like its status or end date indicate if and how the step was completed. + +**Workflow Definition** is the description of a workflow with steps. +The workflow definition provides an ID. When a workflow is started, +every workflow *instance* obtains a unique ID (but still holds the ID +of the workflow definition). diff --git a/mkdocs.yml b/mkdocs.yml index 57ed12c94..6d93707ad 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,6 +2,7 @@ site_name: Workflow Core nav: - Home: index.md - Getting started: getting-started.md + - Overview: architecture.md - External events: external-events.md - Activity workers: activities.md - Error handling: error-handling.md From 409df990d5829b46464b180622d304fc23a51f63 Mon Sep 17 00:00:00 2001 From: "Simon A. Eugster" Date: Mon, 26 Apr 2021 12:02:30 +0200 Subject: [PATCH 2/4] Merge into getting started --- docs/architecture.md | 16 ---------------- docs/getting-started.md | 12 +++++++++++- mkdocs.yml | 1 - 3 files changed, 11 insertions(+), 18 deletions(-) delete mode 100644 docs/architecture.md diff --git a/docs/architecture.md b/docs/architecture.md deleted file mode 100644 index 66314840c..000000000 --- a/docs/architecture.md +++ /dev/null @@ -1,16 +0,0 @@ -# Workflow Core Architecture - -**Host** manages the workflows. Workflows are registered and started here. -The host also provides error and lifecycle events. - -**Registry** contains the workflow definitions with their steps - -**Persistence** persists the workflow states with its execution pointers - -**Execution Pointer** is created when a step is visited during a workflow. -Fields like its status or end date indicate if and how the step was completed. - -**Workflow Definition** is the description of a workflow with steps. -The workflow definition provides an ID. When a workflow is started, -every workflow *instance* obtains a unique ID (but still holds the ID -of the workflow definition). diff --git a/docs/getting-started.md b/docs/getting-started.md index 49ac1f38e..3bd07acd5 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -87,7 +87,7 @@ Each running workflow is persisted to the chosen persistence provider between ea ## Host -The workflow host is the service responsible for executing workflows. It does this by polling the persistence provider for workflow instances that are ready to run, executes them and then passes them back to the persistence provider to by stored for the next time they are run. It is also responsible for publishing events to any workflows that may be waiting on one. +The workflow host is the service responsible for executing workflows. It does this by polling the persistence provider for workflow instances that are ready to run, executes them and then passes them back to the persistence provider to be stored for the next time they are run. It is also responsible for publishing events to any workflows that may be waiting on one. ### Setup @@ -114,6 +114,16 @@ Console.ReadLine(); host.Stop(); ``` +## Registry + +The workflow host keeps workflow definitions in the registry when they are registered. When starting a workflow, the workflow host creates a new instance for the desired workflow definition. + + +## Persistence + +The persistence provider persists the state of a workflow instance with execution pointers. They are created when visiting a step while executing a workflow and hold information about their outcome. + + ## Passing data between steps Each step is intended to be a black-box, therefore they support inputs and outputs. These inputs and outputs can be mapped to a data class that defines the custom data relevant to each workflow instance. diff --git a/mkdocs.yml b/mkdocs.yml index 6d93707ad..57ed12c94 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,7 +2,6 @@ site_name: Workflow Core nav: - Home: index.md - Getting started: getting-started.md - - Overview: architecture.md - External events: external-events.md - Activity workers: activities.md - Error handling: error-handling.md From d4208657fb6c40488195323210529552414bf2a7 Mon Sep 17 00:00:00 2001 From: "Simon A. Eugster" Date: Wed, 9 Jun 2021 08:43:13 +0200 Subject: [PATCH 3/4] Add summaries to interface --- src/WorkflowCore/Interface/IWorkflowHost.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/WorkflowCore/Interface/IWorkflowHost.cs b/src/WorkflowCore/Interface/IWorkflowHost.cs index 8e279096c..a09faf017 100644 --- a/src/WorkflowCore/Interface/IWorkflowHost.cs +++ b/src/WorkflowCore/Interface/IWorkflowHost.cs @@ -18,14 +18,33 @@ public interface IWorkflowHost : IWorkflowController, IActivityController, IHost /// void Stop(); - + /// + /// Fires events when an error is thrown in a workflow step. + /// event StepErrorEventHandler OnStepError; + + /// + /// Fires events on workflow and step lifecycle changes like started and completed steps/workflows + /// and workflow errors. + /// event LifeCycleEventHandler OnLifeCycleEvent; void ReportStepError(WorkflowInstance workflow, WorkflowStep step, Exception exception); //public dependencies to allow for extension method access + + /// + /// Persists workflow data like workflow status and events. + /// IPersistenceProvider PersistenceStore { get; } + + /// + /// Provides locks for resources in the persistence store to ensure exclusive access. + /// IDistributedLockProvider LockProvider { get; } + + /// + /// Contains the workflow definitions which are used for creating workflow instances. + /// IWorkflowRegistry Registry { get; } WorkflowOptions Options { get; } IQueueProvider QueueProvider { get; } From c85097342cd0f96855adaf3e9f1c76477b39a983 Mon Sep 17 00:00:00 2001 From: "Simon A. Eugster" Date: Wed, 9 Jun 2021 08:50:49 +0200 Subject: [PATCH 4/4] Updates according to MR review --- docs/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 3bd07acd5..cd434e001 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -116,12 +116,12 @@ host.Stop(); ## Registry -The workflow host keeps workflow definitions in the registry when they are registered. When starting a workflow, the workflow host creates a new instance for the desired workflow definition. +The registry contains workflow definitions which have been registered. When starting a workflow, the workflow host creates a new instance for the desired workflow definition. ## Persistence -The persistence provider persists the state of a workflow instance with execution pointers. They are created when visiting a step while executing a workflow and hold information about their outcome. +The persistence provider persists internal data which allows to resume workflows. Part of this are execution pointers which are created for every step that is visited during the execution of a workflow. They hold information about the outcome of the step and thus also indicate which step has to be run next. ## Passing data between steps