Workflow Module¶
The description on workflows in this section, applies to MO 2023 (NuGet ver. 13.0.0). Planned release November 2023.
Workflows within MIKE Workbench are used as a means to author worksflows, host and manage workflows, and execute workflows.
A workflow is a series of distinct programming steps or phases. Each step is modeled in WF as an Activity. The .NET Framework provides a library of activities. Activities can be assembled visually into workflows using the Workflow Desginer hosted in the main pane of the workflow in MIKE Workbench.
A Workflow is a named entity that represents a workflow which can be activated or started.
An Activity is the core building blocks in the workflows. An activity can be composed from other activities, either custom developed or activities.
These workflows are based on 3rd party workflow providers loaded by MIKE Workbench.
The following providers are supported:
- Windows Workflow Foundation (WF) first introduced in .NET Framework 4. The WF provider are suppoorted only when running on Windows. This means that the WF provider can be executed from MIKE Workbench and from the native job service provider running on Windows Server og workstation.
- ELSA Workflow component supportig cross platform execution, so that workflows can be used on Linux containers and the new DHI Platform Job Service.
Workflow providers contains dedicated designers and engines for designing and executing workflows.
Each provider contains a range of standard activities provided by the 3rd party workflow component and some custom developed DHI activities with dedicated functionality.
// Get the workflow module.
var module = application.Modules.Get("Workflow Manager") as DHI.Solutions.WorkflowManager.Interfaces.IWorkflowModule;
// Fetch a workflow from its path in the workflow explorer.
var workflow = module.WorkflowList.Fetch("/MyWorkflow");
// Get the provider to use for execution.
var workflowProvider = module.WorkflowProviders.Single(p => p.Name == workflow.WorkflowProviderName);
workflowProvider.Execute(workflow, true, "localhost", 7779);
# Get the workflow module.
module = app.Modules.Get("Workflow Manager")
# Fetch a workflow from its path in the workflow explorer.
workflow = module.WorkflowList.Fetch("/MyWorkflow")
# Get the provider to use for execution.
workflowProvider = None
for provider in module.WorkflowProviders:
if provider.Name == workflow.WorkflowProviderName:
workflowProvider = provider
break
if workflowProvider != None:
# Execute the workflow on local host.
workflowProvider.Execute(workflow, True, "localhost", 7779)
# Get the workflow module.
module = DHI.Solutions.WorkflowManager.Interfaces.IWorkflowModule(app.Modules.Get("Workflow Manager"))
# Fetch a workflow from its path in the workflow explorer.
workflow = module.WorkflowList.Fetch("/MyWorkflow")
# Get the provider to use for execution.
workflowProvider = None
for provider in module.WorkflowProviders:
if provider.Name == workflow.WorkflowProviderName:
workflowProvider = provider
break
if workflowProvider != None:
# Execute the workflow on local host.
workflowProvider.Execute(workflow, True, "localhost", 7779)
Workflow Providers¶
Windows Workflow Foundation (WF)¶
This workflow provider is using Windows Workflow Foundation (WF) with a long range of activities.
NuGet package: DHI.MikeOperations.WorkflowManager.Provider.WF
// Get the Workflow module.
var module = application.Modules.Get("Workflow Manager") as DHI.Solutions.WorkflowManager.Interfaces.IWorkflowModule;
// Use a workflow provider configured in MIKE Workbench or add a new provider runtime
var provider = module.WorkflowProviders.Single(p => p.Name == "Windows Workflow Foundations Provider");
# Get the Workflow module.
module = app.Modules.Get("Workflow Manager")
# Use a workflow provider configured in MIKE Workbench or add a new provider runtime
workflowProvider = None
for provider in module.WorkflowProviders:
if provider.Name == "Windows Workflow Foundations Provider":
workflowProvider = provider
break
# Get the Workflow module.
module = DHI.Solutions.WorkflowManager.Interfaces.IWorkflowModule(app.Modules.Get("Workflow Manager"))
# Use a workflow provider configured in MIKE Workbench or add a new provider runtime
workflowProvider = None
for provider in module.WorkflowProviders:
if provider.Name == "Windows Workflow Foundations Provider":
workflowProvider = provider
break
Custom MIKE OPERATIONS Activities¶
The following custom activities using MIKE OPERATIONS components has been added.
- ExecuteJob Executes a job stored in the job manager of MIKE OPERATIONS.
- RunScenario Runs a scenario stored in the scenario manager of MIKE OPERATIONS.
ELSA¶
Workflow provider using the 3rd party workflow component ELSA
NuGet package: DHI.MikeOperations.WorkflowManager.Provider.ELSA
// Get the workflow module.
var module = application.Modules.Get("Workflow Manager") as DHI.Solutions.WorkflowManager.Interfaces.IWorkflowModule;
// Use a workflow provider configured in MIKE Workbench or add a new provider runtime
var provider = module.WorkflowProviders.Single(p => p.Name == "ELSA Provider");
Custom MIKE OPERATIONS Activities¶
The following custom activities using MIKE OPERATIONS components has been added.
- GetScenarioInfo Gets the scenario information of a scenario.
- ExportDocument Export a document stored in the document manager of MIKE OPERATIONS.
- MakeTimeStamp Makes a time stamp for use in the workflow.
- RunJob Runs a job stored in the job manager of MIKE OPERATIONS. Note that only job service providers running on target frameworks supported by .NET Standard can be executed. This will be the case for jobs using the Platform Job Service provider.
- RunScenario Run a scenario stored in the scenario manager of MIKE OPERATIONS.
- RunScript Runs a script in the script manager of MIKE OPERATIONS.
- RunWorkflow Runs a workflow stored in the workflow manager of MIKE OPERATIONS. This activity will only support workflows based on the ELSA workflow provider.