Scenario execution, cycles, and phases¶
Ibexa Connect is a transactional system, similar to relational databases. Each scenario execution starts with the initialization phase, continues with at least one cycle composed of the operation and commit/rollback phases, and ends with the finalization phase
initialization |
cycle #1 |
operation (reading or writing) |
commit or rollback |
cycle #2 |
operation (reading or writing) |
commit or rollback |
--- |
cycle #N |
operation (reading or writing) |
commit or rollback |
finalization |
Maximum scenario execution time should not exceed 40 minutes for hosted version and 60 minutes for a private instance.
Initialization¶
During the initialization phase, all necessary connections (connection to a database, email service, etc.) are created. They are also checked if each module is capable of performing their intended operation(s).
Cycles¶
Each cycle represents an undividable unit of work composed of a series of operations. It is possible to set the maximum number of cycles in the scenario settings. The default number is 1.
Operation¶
During the operation phase reading and/or writing operation is performed:
-
The reading operation consists of obtaining data from a service that will then be processed by other modules according to a predefined scenario. E.g. the Dropbox > Watch files module returns new bundles (files) created since the last scenario execution.
-
The writing operation consists of sending data to a given service for further processing. E.g. the Dropbox > Upload a file module uploads a file to a Dropbox folder.
Commit¶
If the operation phase is successful for all modules, the commit phase begins during which all operations performed by the modules are committed. This means that Ibexa Connect sends information to all the services involved in the operation phase about its success.
Rollback¶
If an error occurs during the operation or commit phase on any module, the phase is aborted and the rollback phase is started, making all operations during the given cycle void. Some modules do not support rollback and operations performed by these modules cannot be taken back. For more information see the ACID modules section.
Finalization¶
During the finalization phase, open connections (e.g. FTP connections, database connections, etc.) are closed and the scenario is completed.
ACID modules¶
The modules that support rollback (transactional modules) are tagged with the ACID tag:
The modules not tagged with this tag do not support rollback and cannot be reverted back to their initial state in case of an error in other modules.
A typical example is the Email > Send an email module. Once the module sends an email during its operation phase, the sending cannot be undone.
Examples¶
Transfer of bundles between databases
The following example shows how to connect three ACID modules. The aim of the below scenario is to get new rows from a MySQL database, insert (transfer) them into a MSSQL database and then insert the IDs of the rows from the MSSQL database into a PostgreSQL database.
When the scenario starts, the initialization phase is performed first. Ibexa Connect verifies connections to the MySQL, MSSQL and PostgreSQL databases one at a time. If everything goes well and the connections are successful, Ibexa Connect moves on to the operation phase. If an error occurs, the finalization phase starts instead of the operation phase and the scenario is terminated.
Next comes the operation phase. A preset procedure selects (reads) the table rows (bundles) from MySQL. Those rows are then passed to the next module that writes them to a selected table in the MSSQL database. If everything is in order, the last PostgresSQL procedure is called to insert the row IDs returned by the preceding module into the table.
If the operation phase is completed successfully, the commit phase begins. Ibexa Connect calls the SQL COMMIT command for each database and the write operations will be committed.
However, if the operation or commit phase fails due to an error, (e.g. connection failure), Ibexa Connect calls rollback. During the rollback phase, Ibexa Connect goes through all modules one after another and executes the SQL ROLLBACK command for each module to revert each database back to its initial state.
Finally, during the finalization phase, each module will close its connection to the database. nd for each module to revert each database back to its initial state.
Finally, during the finalization phase, each module will close its connection to the database.