Checking for batch processing errors and reprocessing failed cases

After you run periodic data matching or annual renewal batch processes, you must identify any batch processing errors and reprocess any failed cases. Reprocessing and following up on failed cases is a custom development task

About this task

You can use the PDMRunCaseControlManager API to help you with tasks related to the following 4 main error processing scenarios. Typically, you can complete these tasks by implementing a custom batch or batch-streaming process.

  • Capturing a list of cases that failed to process for reporting purposes.
  • Reviewing the reasons for technical case processing failures.
  • Resetting cases that failed for technical reasons so they can be reprocessed when the issues are resolved.
  • Listing the cases that failed for a business reason to follow up with a caseworker.

For more information about the PDMRunCaseControlManager API, see the Javadoc for the API.

The procedure for implementing a batch-streaming process involves 2 main steps:

  1. Determining the list of cases to review.
  2. Determining what work you need to do on each case.

Procedure

  1. Determine the list of cases to review. You can use the default APIs to determine the list of cases as follows.
    1. The list of all failed cases:
       
      final BatchStreamHelper batchStreamHelper = new BatchStreamHelper(); batchStreamHelper.setStartTime(); 
         batchStreamHelper.runChunkMain(key.instanceID, key, <YourBatchMainWrapper>, pdmRunCaseControlManager.listCasesByRunIDAndState(key.runID, 
      PDMRUNCASECONTROLSTATUSEntry.FAILURE, chunkMainParameters, <YourBatchStreamWrapper>); 
    2. The list of all cases that failed for a technical reason:
       
      final BatchStreamHelper batchStreamHelper = new BatchStreamHelper(); batchStreamHelper.setStartTime(); 
         batchStreamHelper.runChunkMain(key.instanceID, key, <YourBatchMainWrapper>, 
         pdmRunCaseControlManager.listFailedCasesByRunIDAndFailureType(key.runID, PDMRUNCASEFAILURETYPECODEEntry.TECHNICAL),
      chunkMainParameters, <YourBatchStreamWrapper>); 
    3. The list of all cases that failed for a business reason:
      final BatchStreamHelper batchStreamHelper = new BatchStreamHelper(); batchStreamHelper.setStartTime(); 
         batchStreamHelper.runChunkMain(key.instanceID, key, <YourBatchMainWrapper>, 
         pdmRunCaseControlManager.listFailedCasesByRunIDAndFailureType(key.runID, PDMRUNCASEFAILURETYPECODEEntry.BUSINESS),
      chunkMainParameters, <YourBatchStreamWrapper>);
  2. Determine the work that you need to do on each case. The PDMRunCaseControlManager APIs helps you to complete the following tasks:
    1. Reviewing the reasons for technical case processing failures.
      final PDMRunCaseControlExt pdmRunCaseControlExt = pdmRunCaseControlManager.getCase(key.runID, batchProcessingID.recordID) 
      final PDMRunCaseControlFailureExt failureDetails = pdmRunCaseControlExt.getCurrentFailureDetails(); 
         log.logFailedCaseAndFailureDetails(pdmRunCaseControlExt, failureDetails.getDateTime(), failureDetails.getReasonCode(), 
      failureDetails.getMessage(), failureDetails.getDetails());
    2. Resetting cases that failed for technical reasons so they can be reprocessed when the issues are resolved.
      final PDMRunCaseControlExt pdmRunCaseControlExt = pdmRunCaseControlManager.getCase(key.runID, batchProcessingID.recordID); 
      pdmRunCaseControlExt.resetCase(); 
    3. Listing the cases that failed for a business reason to follow up with a caseworker.
      final PDMRunCaseControlExt pdmRunCaseControlExt = pdmRunCaseControlManager.getCase(key.runID, batchProcessingID.recordID); 
      final PDMRunCaseControlFailureExt failureDetails = pdmRunCaseControlExt.getCurrentFailureDetails(); 
      if (failureDetails.getDateTime().before(<TimeLimitForFollowup>)) { log.sendCaseWorkerAndSupervisorFollowupNote(pdmRunCaseControlExt); }