Fluent Commerce Logo
Docs
Sign In

Workflow Design Anti-Patterns

Essential knowledge

Author:

Fluent Commerce staff

Changed on:

16 Nov 2023

Overview

Anti-Patterns are patterns found which are not recommended practice, or violate best practice guidelines, and can be harmful to performance and reliability.

Key points

  • Avoid cyclic processes in workflows to prevent performance issues and undesired behavior, ensuring entities return to previous states with user-driven logic.
  • Minimize trigger states in Rulesets for simplified and consistent workflow management.
  • Exercise caution with immediately scheduled events, especially when not essential, to maintain optimal workflow performance and prevent asynchronous processing.
  • Utilize the
    `SetState`
    rule for changing entity states, ensuring accurate tracking, simplified configuration, and a correct Workflow graph.

Cyclic Processes 

A Cyclic Process occurs when one Ruleset calls another Ruleset, which then calls the first Ruleset back.

  • Cyclic Processes should be avoided in your Workflow as they can lead to poor performance and undesirable behavior, including when events are scheduled.
  • Entities can still be put into a prior state as long as there is a User Action driving the logic.

Too Many Trigger States 

A Ruleset has too many trigger states when it is triggered by more states than the Ruleset's operation is applicable to.

  • Having too many trigger states for a Ruleset should be avoided as Workflows with fewer triggers are simpler to manage and more consistent in behavior.

Incorrect usage of Immediately Scheduled Events 

An Immediately Scheduled Event is one scheduled to happen within milliseconds of 'now'.

  • Immediately scheduled events should only be used for cross-domain and cross-retailer events.
  • Using too many of these events is not recommended in most cases as it is less performant.
  • Immediately scheduled events create new execution contexts that will be processed asynchronously and separately from the current Workflow branch.

Changing State within a Custom Mutation 

Changing state within a custom mutation occurs when you use any rule, other than the provided 

`SetState`
 rule, to change the state of an entity.

  • Using the 
    `SetState`
     rule enables the Workflow Engine to correctly track state changes. Using a custom mutation may lead to NO_MATCH events and other problems.
  • Using the 
    `SetState`
     rule to manage state changes will make the Workflow easier to configure and troubleshoot later and avoid duplicating the 
    `SetState`
     rule's logic.
  • Using the 
    `SetState`
     rule ensures the Workflow graph will be correctly drawn in the Workflow Builder
Fluent Commerce staff

Fluent Commerce staff

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.

Fluent Logo