Sending a Batch Report

Report processing is implemented in the sendBatchReport method of the chunker. This method gets the InstanceID, BatchProcessDtls, ProcessedBatchProcessChunkDtlsList and UnprocessedBatchProcessChunkDtlsList as parameters. It is up to the developer as to what information is included in the report and how it's distributed (saved as a file, emailed, sent as a notification or task in the application, etc).

However, typically a count of the chunks processed and skipped as well as the totaled summary information is included, along with the total runtime for the batch program. The curam.core.impl.CuramBatch class is typically used for this purpose, assuming a StringBuffer (called emailMessage in the example) has been built up, then the code example below will result in an email being sent and the report saved to the file system.

Figure 1. Sending a Batch Report using CuramBatch
curamBatchObj.emailMessage = emailMessage.toString();

  // constructing the Email Subject based on a message file entry
  curamBatchObj.setEmailSubject(
    curam.message.BPODETERMINEPRODUCTDELIVERYELIGIBILITY
      .INF_DETERMINE_ELIGIBILITY_SUB);

  // set output file identifier -
  // the initial part of the file name, the datetime is added to this.
  curamBatchObj.outputFileID =    
    curam.message.BPODETERMINEPRODUCTDELIVERYELIGIBILITY
      .INF_DETERMINE_PROD_DEL_ELIG.getMessageText(
        ProgramLocale.getDefaultServerLocale());

  // set the elapsed time
  curamBatchObj.setStartTime(batchProcessDtls.startDateTime);
  curamBatchObj.setEndTime();

  // send email
  curamBatchObj.sendEmail();