Performing custom actions after a process completes
You can use Process Completion Monitor processing to launch custom actions after a work queue or batch process completes a batch of items. For example, you might want to start the writer of a follow-on work queue during nightly batch processing.
Process Completion Monitor processing runs at schedulable intervals and examines the
ProcessHistory table for all completed work queues and batch
processes.
For each completed work queue that it finds, Process Completion Monitor:
- Determines if all the work items in that work queue have either completed or failed.
- Calls the
IBatchCompletedNotificationplugin implementation on a process if the process is complete and has no remaining available or checked-out work items. - Sets
ProcessHistory.NOTIFICATIONSENTto true to invoke theIBatchCompletedNotificationplugin implementation a single time only for any given process.
The IBatchCompletedNotification interface has a
completed method that you can override to perform specific
actions if a work queue or batch process finishes a batch of work. The parameters of the
completed method are the ProcessHistory entity
and the number of failed items. PolicyCenter considers
work queue processing as complete if no work items remain on the queue, other than work
items that failed. PolicyCenter considers a batch process
as complete if the process stopped and its process history is available.
Schedule the Process Completion Monitor batch process
The Process Completion Monitor process runs at schedulable intervals and examines the
ProcessHistory table for all completed work queues and batch processes.
About this task
In the base configuration, Guidewire does not schedule the Process Completion Monitor process. To enable this process, you need to add the process to file scheduler-config.xml.
Procedure
-
In the Guidewire Studio Project window, expand .
- Open scheduler-config.xml.
-
Add the following
<ProcessSchedule>element:<ProcessSchedule process="ProcessCompletionMonitor"> <CronSchedule minutes="*/5"/> </ProcessSchedule>
- Save your changes.
Implement the IBatchCompletedNotification
interface
The Process Completion Monitor calls the IBatchCompletedNotification
plugin implementation on a process if the process is complete and has no remaining available
or checked-out work items.
Procedure
- In the Guidewire Studio Project window, expand .
- Do one of the following:
- Right-click gsrc, then click .
-
Enter a package name, such as
workqueue. - Right-click your implementation class package and click .
-
Enter the name
IBatchCompletedNotificationfor the gosu class. - Click OK.
-
Define your Gosu class, using the following framework:
package myCompany.plugin.workqueue uses gw.plugin.workqueue.IBatchCompletedNotification class IBatchCompletedNotification implements IBatchCompletedNotification { construct() { } override function completed(batch : ProcessHistory, numFailed : int) { //do something return } } - Save your work.
Register a custom batch notification plugin
After you create your IBatchCompletedNotification plugin
implementation, you need to register the plugin with PolicyCenter.
Procedure
- In the Guidewire Studio Project window, expand .
- Right-click registry and click .
-
In the Plugin dialog, enter
IBatchCompletedNotificationfor the name of your plugin. - In the Plugin dialog, click …
- In the Select Plugin Class dialog, type IBatchCompletedNotification and select the IBatchCompletedNotification interface.
-
In the Plugin dialog, click
OK.
Studio creates a GWP file under with the name that you entered.
- Click the Add Plugin icon and select Add Gosu Plugin.
- For Gosu Class, enter your class, including the package.
- Save your changes.
