Launching methods

A batch can be launched by two ways:

  • the first one is to use the main method of the fr.cyberteche.batchservice.BatchService class. This method will search and load the configuration from the configuration file into the classpath, and will launch the execution of the batch.
  • the second is to launch a batch from a another program. Here is an example of an embedded batch:
    // reading config from the configuration file
    Properties properties = PropertiesLoader.getProperties(BatchConfiguration.CONFIGURATION_FILENAME);
    // building of the configuration object
    BatchConfiguration config = new BatchConfiguration(properties);
    
    // initialization and launch of the batch
    BatchService service = new BatchService();
    try {
      service.init(config);
      service.launch();
    } catch (Exception e) {
      service.manageFatalError(e);
      ...
    }