Skip to main content

Guidewire Batch Process



Guidewire Batch Process Implementation

A batch process in Guidewire is a mechanism to run background tasks, typically involving large-scale data processing, such as data exports, reports, or scheduled updates. These processes are executed in the background and are designed to handle high volumes of data efficiently without impacting the performance of the Guidewire application for end-users.

Key Components of a Guidewire Batch Process:
1. Batch Process Class: This is the Gosu class that defines the logic of the batch process.
2. Batch Process Configuration: This defines how the batch process is executed, such as its schedule, thread usage, etc.
3. Batch Step: A batch process can be broken down into multiple steps, where each step handles a specific portion of the task.
4. Batch Process History: This keeps track of the batch process execution, including statuses and results.

Steps to Implement a Batch Process in Gosu:

1. Create the Batch Process Class
The batch process class in Gosu contains the logic for processing data. This class typically extends gw.api.batchprocess.BatchProcess or implements the gw.api.batchprocess.BatchProcessCallback interface, depending on the complexity of the process.

Example: Create a simple batch process class.

package example.batchprocess

uses gw.api.batchprocess.BatchProcess
uses gw.api.batchprocess.BatchProcessParams
uses gw.transaction.Transaction

class MyCustomBatchProcess extends BatchProcess {

  override function runBatch(batchProcessParams: BatchProcessParams): void {
    // Start a transaction to ensure data consistency
    var transaction = Transaction.getCurrent()

    try {
      // Fetch data or perform actions
      var results = retrieveData()
      
      for (result in results) {
        processRecord(result)
      }

      // Commit transaction if everything is successful
      transaction.commit()
    } catch (e: Exception) {
      // Rollback transaction if an error occurs
      transaction.rollback()
      throw e
    }
  }

  function retrieveData(): List {
    // Example: Retrieve a list of data records from the database
    return [ "Record1", "Record2", "Record3" ]
  }

  function processRecord(record: String): void {
    // Example: Process each record
    print("Processing: " + record)
  }
}

2. Configure the Batch Process
You need to configure how the batch process will run, which typically involves defining the process in the BatchProcessConfig configuration file or through the Guidewire Studio.

Example: Batch process configuration (XML format).

<batchprocess-config>
  <batchprocess name="MyCustomBatchProcess">
    <description>My custom batch process</description>
    <classname>example.batchprocess.MyCustomBatchProcess</classname>
    <defaultfrequency>Daily</defaultfrequency>
    <defaultstarttime>02:00</defaultstarttime>
    <threadcount>4</threadcount>
  </batchprocess>
</batchprocess-config>

3. Register the Batch Process in the Application
To make the batch process available in the Guidewire environment, it needs to be registered in the appropriate application configuration files.
Include it in Process Plugin related class and batch process related type list files 


This registration links the batch process logic to the Guidewire application, making it available for scheduling and execution.

4. Schedule the Batch Process
You can schedule the batch process to run at specific times or intervals. This can be done through the Guidewire user interface or by configuring it directly in the application.

Example: Schedule through the Guidewire UI.
1. Navigate to Administration > Batch Processes.
2. Locate MyCustomBatchProcess in the list.
3. Set up the schedule, frequency, and other execution parameters.

5. Monitor and Manage the Batch Process
After the batch process is scheduled, it's essential to monitor its execution. Guidewire provides tools to track the status of batch processes, view logs, and manage process history.

- Batch Process Monitor: This tool in Guidewire allows administrators to view the status of running batch processes, review their history, and restart or stop processes if needed.
- Logging: Ensure that your batch process writes sufficient logs to track its progress and troubleshoot any issues.

Example: Add logging to the batch process.

uses gw.util.logging.Logger

class MyCustomBatchProcess extends BatchProcess {
  
  private static var _logger = Logger.getLogger("example.batchprocess.MyCustomBatchProcess")

  override function runBatch(batchProcessParams: BatchProcessParams): void {
    _logger.info("Starting batch process...")
    
    try {
      super.runBatch(batchProcessParams)
      _logger.info("Batch process completed successfully.")
    } catch (e: Exception) {
      _logger.error("Batch process failed: " + e.getMessage())
      throw e
    }
  }
}

6. Deploy and Test the Batch Process
Once everything is set up, deploy the batch process to a test environment.

- Deploy the Gosu class and configuration files to the appropriate directories.
- Test the process manually to ensure it works as expected, processes data correctly, and handles errors gracefully.

Conclusion:
Implementing a batch process in Guidewire involves creating a Gosu class with the logic for data processing, configuring the process in the application, and ensuring proper scheduling and monitoring. By following these steps, you can efficiently manage large-scale background tasks in Guidewire, ensuring that they are executed reliably and can handle large volumes of data without affecting the system's performance.

Comments

Popular posts from this blog

"How to maintain or retain tabs in same tab after button click events or postback?" using JQuery in ASP.NET C#

In this post I'll share an details about " How to maintain or retain tabs in same tab after button click events or postback? " Step 1: you need to download Jquery and JQueryUI Javascript libraries from this site http://jqueryui.com/ Step 2: As usually you can create ASP.NET website from Visual Studio IDE and add Jquery and JqueryUI plugins in the header section of aspx page. Step 3: Add HiddenField control inside aspx page which is very useful to retain tab in same page Step 4: Use the HiddenField ID in Jquery code to indicate that CurrentTab Index Step 5: In code Behind, using Enumerations concept give the tab index values as user defined variable  Step 6: Use the Enum values in every Button click events on different tabs to check that tab could be retained in the same tab Further, Here I'll give the code details and snap shot pictures, 1. Default.aspx: Design Page First Second Third ...

Login and Registration forms in C# windows application with Back end Microsoft SQL Server for data access

In this article, I'm gonna share about how to make login and register form with MS SQL database; 1. Flow Chart Logic 2. Normal Features 3. Form Designs Login Form Design Sign in Form Design Password Retrieve Form 4. Database Design and SQL queries and Stored Procedure Create new Database as "schooldata" create table registerdata (  ID int identity,  Username nvarchar(100),  Password nvarchar(100),  Fullname  nvarchar(100),  MobileNO nvarchar(100),  EmailID nvarchar(100)  ) select * from registerdata create procedure regis (  @Username as nvarchar(100),  @Password as nvarchar(100),  @Fullname as nvarchar(100),  @MobileNO as nvarchar(100),  @EmailID as nvarchar(100)  ) as begin insert into registerdata (Username, Password, Fullname, MobileNO,EmailID) values (@Username, @Password, @Fullname, @MobileNO, @EmailID) ...

Guidewire Related Interview Question and answers part 1

common Guidewire questions and answers 20 Guidewire BC Q&A Top 100 Guidewire Interview FAQ Guidewire Claimcenter 20 Interview Questions Guidewire Rating concepts