Configuring batch processes
Cloud API supports the ability to start batch processes. For information on how to use
the /systemtools/v1/batch-processes/{batchProcessType}/start endpoint,
see the Cloud API Consumer Guide.
Some batch processes let you specify arguments when you run the batch process. These arguments perform the function of input parameters, and they can change the way the batch process runs.
You can create custom batch processes which take arguments. If you want to be able to
submit arguments to the /start endpoint, then some configuration of
Cloud API is required. This topic describes this configuration.
Configuring Cloud API to support custom batch process arguments
InsuranceSuite applications do not have a uniform format for arguments for batch processes. Some batch processes may expect strings, while others may expect custom POJOs (Plain Old Java Objects). There is no general way for Cloud API to support batch process arguments for all batch process types. Therefore, if you have implemented a custom batch process that uses arguments and you want to start that batch process through Cloud API with arguments, you must configure Cloud API to handle the arguments.
This configuration requires two steps:
- Adding a schema property to the
BatchProcessArgumentsschema. - Adding handling code to the
BatchProcessExtResourceclass to convert the payload into arguments
Configuring the BatchProcessArguments schema
The BatchProcessArguments schema defines the information that can be
included as arguments with a call to the
/systemtools/v1/batch-processes/{batchProcessType}/start endpoint.
For more information on general schema configuration, see Endpoint architecture.
To configure a custom batch process for arguments, you must add a property to this schema.
- The name of the property must be the same as the code of the
BatchProcessTypetypecode, ignoring case. Guidewire recommends using all lowercase letters. - The type of this property depends on the underlying argument type that the batch process expects. Guidewire recommends that the property be an object with well-defined property names that describe what the arguments conceptually represent.
The schema extension must be declared in the
systemtools_ext-1.0.schema.json schema file.
systemtools_ext-1.0.schema.json schema
file would include the
following: "definitions": {
"BatchProcessArguments": {
"properties": {
"groupmetrics_ext": {
"title": "GroupMetrics_Ext",
"description": "Arguments for the GroupMetrics_Ext batch process",
"$ref": "#/definitions/GroupMetrics_ExtArguments"
}
}
},
"GroupMetrics_ExtArguments": {
"title": "GroupMetrics_ExtArguments",
"description": "Arguments for the GroupMetrics_Ext batch process",
"type": "object",
"properties": {
"groupName": {
"title": "GroupName",
"description": "The name of the group to process",
"type": "string"
}
}
}Configuring the BatchProcessExtResource class
The BatchProcessExtResource resource class is a Gosu file that defines
required behaviors for working with batch process elements.
To configure a custom batch process for arguments, you must add handling code to the
populateCustomBatchProcessArgumentsArray method in the
BatchProcessExtResource resource class to convert the payload into
arguments. Override the method (if it has not already been overridden) and add an
if statement for this batch process type that inspects the JSON
object, extracts the relevant data, and puts it into an array.
BatchProcessExtResource resource class to implement the
GroupName argument for the GroupMetrics_Ext custom batch process.
The populateCustomBatchProcessArgumentsArray method would look like
this:protected override function populateCustomBatchProcessArgumentsArray
(json : JsonObject) : Serializable[] {
var result : Serializable[]
if (this.Element.getType() == BatchProcessType.TC_GroupMetrics_Ext) {
result = {json.getString("groupName")}
} else if ( /* other batch process type handling goes here */ ) {
...
}
return result
}