description |
---|
This section provides a comprehensive overview of fundamental principles and key elements that form the foundation of Elsa. |
A workflow is a sequence of steps called activities that represents a process. Workflows can be created visually or programmatically. In Elsa, a workflow is represented by an instance of the Workflow
class. The Workflow class has a Root
property of type IActivity
, which is scheduled for execution when the workflow starts.
A workflow instance represents a database-persisted instance of a workflow in execution, encapsulated by the WorkflowInstance
class.
An activity is a unit of work executed by the workflow engine. In Elsa, these are classes implementing the IActivity
interface and can be linked or composed together to form a workflow.
A bookmark signifies a pause point in a workflow, enabling the workflow to be resumed later. It is typically created by blocking activities such as the Event
or Delay
activity.
A trigger is an activity with its Kind
metadata set to Trigger
and is able to start new workflow instances of the containing workflow. For example, the HttpEndpoint
activity is a trigger that enables the containing workflow to be executed when a given URL is requested.
Blocking activities are those which do not complete execution immediately upon initiation. They often create bookmarks, halting the workflow's progress until resumed. This halting nature coins the term "blocking."
This term describes the period during which the workflow runner actively executes activities. A workflow executing continuously from start to finish occurs in a single burst, whereas a workflow interrupted by a blocking activity results in multiple bursts, resuming on subsequent triggers.
A Correlation ID is a flexible identifier linking related workflows and external entities. It aids in tracing workflows in distributed, asynchronous, or hierarchical systems. Assigning a Correlation ID allows tracking of related workflows and ties them to specific business objects like documents, customers, or orders.
Activities in a flowchart are connected that defines the logic of the workflow. Each activity can have one ore more potential results, which are referred to as outcomes. These outcomes are visually displayed as "ports" on the activity. For example, the Decision
activity has two potential outcomes: True
and False
. When using the designer, the user can connect a subsequent activity to these outcomes. This powerful mechanism simplifies workflows by eliminating the need for separate decision activities to evaluate an activity's result.
In Elsa, input can refer to two things:
- Input to an activity.
- Input to a workflow.
Most activities have at least one input, represented as public properties. For instance, the WriteLine
activity has a Text
property used to display a string in the console window.
Workflows can receive input from the application. For example, a workflow processing an order can get the Order ID through an input like OrderId
.
In workflows, activities can produce output data for later steps. Outputs pass info like numbers or text to the next activity. Activities can create results and outputs. You can generate outputs, like booleans, for decision-making, but it's easier to use outcomes. Use outputs for data, like database results, when no decisions are needed.
Variables can be set at the workflow level to store data. Use dynamic expressions to set or retrieve these variables. Activity outputs can update a variable automatically, allowing them to be used by the next activities. This makes it easy to transfer and store data for activities.