UiPath provides an inbuilt project template for enterprise integration, to create transactional business processes. This template is called Robotic Enterprise Framework (Aka, RE Framework). If you are looking forward to following the best practices for rpa development, go ahead and choose this template. Logging, exception handling, and initializations are part of the template. So, it puts you a couple of steps ahead to start development with the basic components already included in your automation project.
This template is based on the state machine. When you open UiPath Studio or go to the home tab, you can choose this template from the list of available project templates. This is shown in the following figure:
Now, when you start a new project with this template, UiPath creates a diagram that looks as follows:
A closer view of the entire diagram looks like this:
By selecting this template, all the pre-defined state containers are automatically added to the diagram. This includes, application initialization, fetching data, processing, and terminating a transaction. Flow from one state to another is managed using transitions. So, all the states in the state machine are connected through one or more transitions. There are the following four states in the above state machine diagram:
- Get Transactional Data.
- Process Transaction.
- End Process.
Each of these states represents a step in the workflow, and bot execution moves from one state to another after successfully completing a step. A brief description of each of the states is as follows.
In the Initialization state, the bot reads all the configuration from the config file and initializes all applications. Based on the successful completion or error condition, the bot either moves to the next state (Get Transactional Data) or to the end state. It is important to consider that before transitioning to the end state, the bot retires for the maximum retry attempts configured.
In the Get Transactional Data state, the bot reads a new transaction and moves to the next state where it actually processes the new transaction. During the processing, at one point, it transitions to the end state when all the transactions have been processed.
In the Process Transaction state, the transaction fetched in the previous step is processed. There are three transitions from this state:
- If the transaction is successfully processed, the bot loops through the next transaction and returns back the process transaction state. This continues until there are no more transactions.
- If the bot encounters a business rule exception, then the bot transitions to gracefully handle the business exception and continues to fetch the next transaction for processing.
- If the bot encounters an unhandled exception, the bot transitions to the End Process state after retrying for the configured max retry attempts.
In the End Process state, all applications are closed and the process is terminated.