The Managed Operations module allows the end user to fully control the starting and running of any application method in the XAF application. The developer can implement any method as a Managed Operation. The Managed Operations service displays the method execution process in a special View. The user can interrupt, suspend, or resume the process. It is possible to monitor a number of parallel processes. The start of the Managed Operation is logged, the information can be stored in a database.
To see the Managed Operations in action, refer to the Main|Actions|ManagedOperations section in the Xafari Northwind demo installed with Xafari.
The Managed Operations service offers a number of specific features, that allow to implement the execution of the application method in different ways, depending on the needs of the end customer. The key features of the service are listed below:
- Synchronous or asynchronous Managed Operations
- Global or local Managed Operations
- Unique Managed Operations
Let's look at them in detail.
Synchronous or asynchronous Managed Operations
When the Synchronous Managed Operation is run, it is not possible to execute other actions in the client application. You have to wait until the launched operation finishes to continue the work. In the course of execution of the operation, the user can only monitor the process. Besides the standard monitoring window, the progress of the synchronous operation can be displayed by the progress indicator or infinite scrolling bar.
The Asynchronous Managed Operation supports the execution of the application method without suspending other actions of the application. The user can run multiple instances in parallel.
The Managed Operation can have a number of subprocesses. Each subprocess is a Managed Operation which is executed as a part of the main operation. The XafariManagedOperations module allows for monitoring the main operation and each subprocess separately. The figure below shows a Detail View of the Managed Operation with subprocesses in the Web application. The list of subprocesses is available on the Child Process tab.
Local and global Managed Operations
The information on starting and running the Managed Operation can be stored in the application database. Such Managed Operation is called Global Managed Operation. It is also possible to execute the operation locally on the client's computer without saving the information to the database. The information is lost after completion of execution of the application. The Managed Operation executed in such manner is called local. By default, all operations are of the global type, though it is possible to change the type of operation at the time of initialization.
Unique Managed Operations
In some cases, it may be required that only one user is able start the operation at any moment in time, and can only do it once. For example, two plan budget calculation processes or two payroll calculation processes can not be run concurrently. The unique Managed Operation implies a ban on the creation of another instance while the operation is being executed. If a unique operation has been started and is currently running, then the user attempting to run another instance will get the respective message, as shown in the figure below.
Logging allows to save the history of execution of Managed Operations for subsequent review and analysis.
It is possible to split the log into sections (blocks). Splitting to blocks is required, if the operation is "heavy", i. e. if large amount of information is generated in the course of execution. The blocks that contain records with error messages or warnings are marked accordingly. Some blocks with messages of various types are shown in the figure below:
It is possible to add to the log, only messages with a defined trace level («Warning», «Error» etc.).
To find out more about the Managed Operations, refer to the following documents:
- Getting Started
- Example of Subprocesses
- Managed Operations in Application
- Learn More
- XafariManagedOperations class