Author:
Fluent Commerce
Changed on:
15 May 2024
This section covers the fundamentals of the Workflow Engine, provides an overview of the architecture, identifies key concepts, and prepares clients to build and use their workflows.
The Workflow Engine works by shifting system logic (previously available in the platform API), code and middleware, into rule-based and code-free workflows.
The Workflow Engine allows clients to get to market quickly by making use of the Fluent platform's pre-built workflows or by customising and differentiating their Omni-channel commerce processes further by configuring workflows and custom rules with the Rules SDK.
The Workflow Engine is made of the following components:
The Workflow Engine is the foundation and engine of the Fluent platform. It sits under the Commerce apps to execute business logic driven by rules and workflows.
The Workflow Engine is made of the following key components:
The Workflow Builder provides an intuitive user experience for non-technical users to view, modify and create workflows and user actions. Additionally, it helps to reduce implementation costs and time to market.
To read more, see the Workflow Builder page.
The Rules SDK enables developers to write custom logic into rules, which are compiled into a plugin that can be uploaded for use in workflows without affecting any other part of their system.
To read more and get started with developing custom rules, see the Rules SDK page.
Below are the key concepts that make up the capability of the Workflow Engine:
A workflow defines the logical flow or lifecycle of a top-level entity1 within a domain2. For example, the Order Management domain has a top-level entity of
`Order`
`Order`
`Order`
`Order`
`OrderItem`
`Customer`
`Order`
`Consignment`
`Order`
A lifecycle typically involves a number of stages in which the entity moves. The stages that an entity moves through a workflow are represented through
`State`
The transition of an entity through its different states within the lifecycle is driven by business logic contained within Rules.
`Rules`
`RuleSets`
`Event`
A retailer can have multiple workflows associated with a top-level entity. However, the entry trigger for each of the workflows should be unique. This allows for multiple workflows to exist with different entry triggers for the same Entity so that the system can identify one and only one workflow to execute.
Workflows can contain multiple Rulesets, and Rulesets can contain multiple Rules.
Workflows for an entity can interact with the workflows of other Entities. These interactions occur through Events.
1 An entity is an object of importance in the system that we want to model and store information about. View Fluent Commerce's entity-relationship model which represents the business data schema in graphical form.
2 A domain is an area of capability, such as Order Management, Global Inventory, Store Fulfillment, etc.
A State represents a specific condition and phase of the entity at any given time within the lifecycle. In other words, it represents the point at which the entity is within the workflow's business logic.
An Event represents something that has, will, or is happening within the system. An Event is typically used to ask or trigger the system to do something or log activity of what has happened within the system.
For example:
Essentially, events are notifications within the system that can be consumed by various internal or external systems in order to take further action.
A Trigger is the exact criteria for which a specific Ruleset within a Workflow will be executed upon a given Event.
A Ruleset is triggered when an Event is received that contains the exact matching criteria for that Ruleset.
A Trigger essentially defines the contract for the Event required to execute its Ruleset.
Rulesets can be triggered via events received either internally, externally, or via user-generated actions.
A Rule represents an atomic business logic which can be configured and reused. A commonly used analogy for describing Rules is LEGO bricks which we can click together in different configurations to create a different outcome.
Some common examples of use cases for Rules include the following:
Any changes to be made as a result of running a Rule by the Workflow Engine are returned in the form of an Action.
A Ruleset is a collection of one or more Rules which get executed upon receiving a matching trigger via an Event. Rulesets are a combination of rules to deliver a piece of business logic.
The execution of a Ruleset can transition the entity through the lifecycle by changing its state, or it may just result in non-transitional actions, such as sending an email to a customer.
An Action represents an outcome of a Rule.
Some common examples of Actions include:
Actions are generally collected and run together at the end of a Ruleset. Doing so allows the system to maintain an assignable or transactional process.
For example, if one Rule fails, the entity is not left in a half-modified state, and the same Ruleset can be re-run at a later stage without risk of duplicating entities or double sending customer notifications.
User Actions are the mechanism by which user interactions can be integrated with workflows. For example, via our mobile-friendly web applications, Fluent OMS and Fluent Store.
A User Action is essentially an external view of a Trigger, along with some additional attributes to represent UI interactions, such as buttons and labels, etc. The result is that a user can click a button on Fluent OMS, potentially supply additional data via inputs, and it fires the event that will trigger a specific Ruleset relevant to the specific business logic intended to be executed by that user action.
Finally, it is important to understand how versioning works within the Workflow Engine. Workflows are versioned, thus any subsequent modification of an existing workflow by a Retailer results in the automatic creation of a new version of the workflow.
Workflows have a major version and a minor version associated with it:
Importantly, to maintain data integrity, an entity instance executing within a workflow will continue executing within the same workflow version even if a newer version exists.
New instances of the entity will be executed within the new version of the workflow.
Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.