Running a SysOperation service

Because a user is able to run a service by starting it in the user interface, the menu item is an important part of a SysOperation service. As we have seen earlier, the menu item has the following properties that are required by the SysOperation framework:

  • A parameters property that contains a reference to the service and service operation
  • An enum parameter that determines the execution mode
  • An object property where the controller that will be used is specified
  • A label that will be displayed on the dialog

We will look at the first two properties now and discuss the others later in the chapter.

Service and service operation

The menu item is linked to the service and the service operation in the Parameters property. The format in which this parameter should be provided is ServiceClass. ServiceOperation, where ServiceClass is the name of the service class and ServiceOperation is the name of the service operation, separated by a period.

Execution modes

The SysOperation framework allows both synchronous and asynchronous processing. In our example, we used synchronous processing by specifying the execution mode using the EnumTypeParameter and EnumParameter properties. The EnumTypeParameter property is set to SysOperationExecutionMode, which is a base enum that holds a value for each execution mode. The execution mode is specified in the EnumParameter property. There are four options to choose from:

  • Synchronous
  • Asynchronous
  • ReliableAsynchronous
  • ScheduledBatch

When the execution mode is not specified, ReliableAsynchronous will be used. To change the execution mode of our service, simply change the EnumParameter property on the CVRRentalDueDateReminderService menu item to the execution mode that you want to use and run the service again. Let's look at what the results would be.

Synchronous

Synchronous execution of a SysOperation service has the same behavior as running a RunBaseBatch class. When you execute a SysOperation service synchronously but not in a batch, the client will be unresponsive for the time it takes for the operation to complete. All the other execution modes are forms of an asynchronous execution, including the execution of a synchronous service in the batch. When you enable the Batch processing checkbox on the Batch tab, a batch job will be created, analogous to the behavior of RunBaseBatch.

Asynchronous

When a SysOperation service uses the asynchronous execution mode, the client will still be responsive while the operation is executed. This is useful when you want a process to run in the background.

To run a service asynchronously, the service class must have an associated service node in the AOT. The service node has to be part of the AxClient service group, and the service group must be deployed again after the service is added to the group. If this isn't the case, the service will still run synchronously instead of asynchronously.

ReliableAsynchronous

The ReliableAsynchronous execution mode differs from the regular asynchronous mode in that it creates a batch job. This ensures that the service will be executed completely even if the client session in which it was started was destroyed, hence it is reliable. The service will be visible among other scheduled batch jobs, but unlike these, it will be deleted when the execution is complete. It is still visible in the batch job history, though.

The ReliableAsynchronous execution mode also differs from regular batches in that the user who executes the services will receive Infolog messages from the service when it is complete. This isn't the case with regular batches where you need to manually check the log on the batch job.

ScheduledBatch

The ScheduledBatch execution mode will schedule a batch job for the SysOperation service. Even when you don't check the Batch processing checkbox on the Batch tab of the service, it will still be executed in the batch. On the same tab, you can set up the recurrence for the batch job. This will also be used even if the Batch processing checkbox isn't checked.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.129.90