- 03 Oct 2022
- 2 Minutes to read
- Print
- DarkLight
Understanding Processes
- Updated on 03 Oct 2022
- 2 Minutes to read
- Print
- DarkLight
Most processes generally fall between two categories: foreground or background processes, but some business logic may implement both methods to achieve the desired result. A foreground process is always experienced by the end user, while a background process runs without user intervention. Processes can also run sequentially or in parallel to other processes.
Background Processes vs. Foreground Processes
What is a Foreground Process?
A foreground process is a process that relies on a user to start or interact with them. An example of a foreground process would be a user clicking CREATE FLOW in the Studio. Another example would be a user logging into a web or mobile application.
What is a Background Process?
A background process runs tasks without requiring a user's attention to operate. An example of a background process would be a Thread Job which collects or updates information to a dashboard that runs when the application starts. Another example would be a Scheduled Job that checks an email server for new messages for a specified user every weekday at 8 am.
Running a Background Process from a Foreground Process
A background process can also be started from a foreground process using a step that enables asynchronous behavior. An asynchronous behavior allows a task to run independently on a different thread than the parent process. Async behavior can be accomplished using a sub Flow or Flow step that enables async behavior, such as the Go Async or Run Flows For List steps.
Understanding Parallel Processing and Sequential Processing
Parallel Process
A Parallel process is when two or more processes are running simultaneously. One way of implementing a parallel process is using the Run Flows For List step. This step creates asynchronous Flows for each item in the list to speed up the processing of a large list. The Thread Count option of the step determines the number of threads that run simultaneously. For example, processing a list of 100 items using a Thread Count of 5 will result in 5 items on the list running the specified Flow simultaneously. As one finishes, it is immediately populated with the next item in the list until the entire list of items is completed.
Sequential Process
A Sequential process is when a task requires a previous task to be completed before execution. Some common use cases that involve a sequential process would be submitting a new patient registration form, an approval process for equipment, or displaying a list of medications to a patient based on specified criteria.
Sequential Process Flow Example
The below screenshot displays a sequential process Flow that has the user input information into a Form. Based on the interest the user selects, an email is sent that includes a coupon offer.