The P42 Workflow Engine is a flexible and extendable platform designed to handle automation of various workflows. It supports different types of workflow steps, such as conditional, loop, switch, parallel, and sequential steps, among others.
The core unit is a WorkflowStep
, which performs an action. Input and output are represented by IWorkflowStepInput
and IWorkflowStepOutput
respectively. Steps can be combined in various ways to form complex workflows.
Special step types - Conditional
, Loop
, Parallel
, Sequential
, and ExceptionHandler
steps - provide flexibility in controlling the flow of execution.
- Extensibility: You can easily extend new types of steps by creating new interfaces that extend
IWorkflowStep
. - Flexibility: Includes built-in support for conditionals (if-then-else), loops, handling exceptions, and executing steps in parallel or sequential order.
- Robustness: Exception handling allows workflows to fail gracefully when things go wrong.
To create a new workflow, first create the individual steps. Each step is an implementation of the IWorkflowStep
interface. Instead of implementing IWorkflowStep
directly, you may want to use or extend one of the more specialized interfaces such as ILoopWorkflowStep
or IConditionalWorkflowStep
.
Once the steps have been defined, they can be combined in a Workflow
object by adding them to the Steps
list.
Here's an example of creating a simple workflow with a loop:
var workflow = new Workflow()
{
Steps =
{
new SimpleLoopWorkflowStep
{
LoopStep = new MyStep(),
LoopCondition = inputs => inputs.Count < 5,
Inputs = new List
{
// Initialize your input
}
}
}
};
To execute the workflow, simply call the Perform
method:
If you run into any issues or have suggestions for improvements, please submit an issue on our GitHub page. Contributions are welcome!