Ubik Batch Server Launches

From UbikWiki

Use case

Launches are useful when you want to use the same Batch code (Class) but with different parameters. Example:

  • a batch that computes Prices on the same Database structure but deployed on differents Database servers (10 per Store)

Solution:

  • Create a Batch with Launches and configure on launches per connection pool.

Description

Different parameters in start request for each launch :

Image:launches_sqlparameters.gif

Different pools in the Datasource request for each launch :

Image:launches_pool.gif

Different timezones for each launch :

Image:launches_timezone.gif

We can also combine all those cases, and have different parameters, pools and timezones for each launch.

The declaration of each parameter, pool or timezone is done through WebControler interface.

Once you have declared some launches, all actions (as enable/disable, execute) will be done on launches, and no more on the batch.

Configuration of your batch to run with launches

Your starting request can have bind variables (this lets you modify them in initialize and is a better way to express parameters): Replace

DaoSqlBatchStart starter = 
     new DaoSqlBatchStart("jdbc/stores", 
         "SELECT ...",100,false,
         new String[] {DoDemandeRequete.class.getName()});
lanceur.setBatchStart(starter);

by

DaoSqlBatchStart starter = 
     new DaoSqlBatchStart("jdbc/stores", 
         "SELECT ...",100,false,
         new String[] {DoDemandeRequete.class.getName()});
DBBatchStartParametersComputer batchStartParamsComputer =
    new DBBatchStartParametersComputer( 
         IBatchAnalyse.C_GROUPE, 
         IBatchAnalyse.C_TRAITEMENT_COMPILER_STAT_540); 
MultipleBatchLauncher metaBatchStart = 
     lanceur.newMultipleBatchLauncher(starter, batchStartParamsComputer);
lanceur.setMultipleBatchStart(metaBatchStart);
Personal tools