IBatchProcess

IBatchProcess is the interfacefor implementing batch processes. It exposes 4 methods viz.
  1. PreProcess - This is the first method called by the XecMe framework. You can do initialization, setting up connection, queue etc.
  2. Process - This method is the second method called by the framework and the batch processing is to be done in this method.
  3. PostProcess - This is the last method called called by the framework. You can put the cleanup code in this.
  4. Exception - This method is called when any of the above methods throw an exception. You can place the exception logging code in this (you cannot handle the exception and go back). Once this method is called you will bail out of the process.
For example, if you PreProcess method throws and exception that was not handled. Framework will catch that exception and pass it to Exception method. Once this method returns, the process bail out. Note that the other 2 methods are not called. So whenever there is a unhandled exception thrown be any of the Process methods the sequence of execution break and the process bails out after calling the Exception method.

public class MyBatch : IBatchProcess
{
    void PreProcess()
    {
        ///Initializing logic for the batch process. You can do basic validation whether all the integrating systems are accepting connection
    }

    void Process()
    {
        ///Core batch job processing.
    }

    void PostProcess()
    {
        ///Any clean uo activity in the job
    }

    void Exception(Exception exception)
    {
        ///Exception logging and incident notification
    }
}

Last edited Jan 30, 2013 at 8:35 PM by slolam, version 4

Comments

No comments yet.