As a workflow engine, flor takes in input process definitions and executes them. These executions, in turn, call pieces of Ruby code or external scripts to perform the actual work. Those pieces of code and scripts are referred to as “taskers”.
The flor workflow engine can be created as follows by installing the gem ‘flor/unit’ and asking the flor library inside the ruby file.
1. Add the command to your gem file:
2. Run: bundle update.
3. Use the basic control-flow pattern in flor.
4. Create a ruby file and add this code to it.
5. “Require flor” gem for using them in the entire program file.
6. Database connection:
The database is used to store the execution process. The user can use MySQL, PostgreSQL, and SQLite DB. The sequel does not support the MongoDB adapter.
7. Starting and launching the flor unit execution:
To begin the execution flow of flor, it is important to start the process using the ‘flor’ gem. After starting, it’s time to launch. During launch execution, it is important to mention the tasker to perform, according to the flow of execution.
Mentioned below are a few Basic Control flow patterns that can be used. Let’s explore how to execute the taskers in various patterns.
Executes the ‘child’ expressions(taskers) in sequence.
b) Parallel Split:
Here tasker performs concurrently. It replies to its parent node when both taskers have replied.
It is the simplest flor synchronization tool. The concurrence waits (by default) for all its children to reply.
8. Adding tasker and Implementation class:
While adding the tasker it is required to specify the class where it will be executed. The implementation class will be ruby, which is inherited from ‘BasicTasker’. It also consists of an execution message.
The below code highlights how the user can perform the tasks with all the implementation related to the task. The user can fetch the data from DB and execution.
9. Tree format for flor: