Project

General

Profile

Batch Processes

Batch processes can be started manually or automatically. This section will describe what configuration is required for each case.

This assumes the directory configuration to define the batch process account has been completed.

For automatic startup (via the scheduler or the server scripts), the batch process requires to be setup for automatic start, so it can be launched by the FWD server.

Auto-Start of a Batch Process.

Automatic start of a batch process at server launch is done via the Scheduler. An example how to schedule it:

 <node class="container" name="scheduler">
     <node class="job" name="start_appserver">
       <node-attribute name="type" value="process"/>
       <node-attribute name="target" value="batch_process_name"/>
       <node-attribute name="enabled" value="TRUE"/>
       <node-attribute name="mode" value="now"/>
     </node>
   </node>

Here, replace, batch_process_name with the name of the FWD process account

The above example will start the batch process automatically after the FWD server has started, once. Change the now value for the mode attribute to ONE_TIME or RECURRING, if you want this program to run at different times.

Launching a Batch Process via the Server Startup Script.

The demo Hotel applications like Hotel GUI have server.sh and server.cmd scripts, which accept a -b batch_process_name argument, to let the FWD server start a batch program automatically.

You can simply execute ./server.sh -b batch_process_name and the FWD server will launch the FWD client for this batch process automatically.

To see the exact Java command used to to this, run ./server.sh -t -b batch_process_name, which will be something like:

java ... com.goldencode.p2j.main.ServerDriver -b batch_process_name server.xml net:connection:secure=true net:server:secure_port=3333 net:server:insecure_port=3433

Manual Launch of the Batch Process

To launch the batch process manually, this will require to have the private key and certificate in an external store, plus the server and root CA certificate in a different store. For example:

  • srv-certs.store will hold the root CA certificate and the FWD server certificate
  • batch_process_name.store will hold the certificate and private key for the batch_process_name alias.

This configuration can be kept separately in a deploy/batch/ folder, with sub-folders for each process. This subfolder, like deploy/batch/batch_process_name, will always have:

  • the srv-certs.store file
  • the batch_process_name.store file
  • a client.xml file which will hold the configuration for the batch process which will be launched

The structure of the client.xml follows the bootstrap configuration, from the client category.

For example, the structure can be:

<?xml version="1.0"?>
<node type="client">
   <client>
      <mode batch="true" />
      <driver background="true" />
      <cmd-line-option startup-procedure="batch_program_to_start.p"/>
   </client>

   <security>
      <truststore filename="srv-certs.store" />
      <truststore alias="standard" />
      <keystore filename="batch_process_name.store" />
      <keystore processalias="batch_process_name" />
   </security>

   <access>
      <password truststore="[password-truststore]" />
      <password keystore="[password-keystore]" />
      <password keyentry="[password-keyentry]"/>
   </access>
</node>

Where you will need to customize:

  • batch_program_to_start.p, with the converted legacy program to run
  • srv-certs.store, with the name of the trust store holding the root CA and server certificate
  • standard, with the certificate alias for the FWD server
  • batch_process_name.store, with the name of the store holding the certificate and private key for the batch process alias.
  • processalias, with the certificate alias for the batch process account.
  • truststore, with the password for the trust-store (srv-certs.store).
  • keystore, with the password for the process certificate store (batch_process_name.store).
  • keyentry, with the password for the private key inside the keystore (batch_process_name.store).

Once this are configured, the batch process can be started by copying the client.sh or client.cmd script and executing it as if you want to start a normal FWD client.

In short, the command to launch it (from within the same folder where the stores and client.xml exists, this assumes deploy/batch/batch_process_name), will be:

java -XX:+HeapDumpOnOutOfMemoryError -Djava.library.path=../../lib/ -classpath ../../lib/p2j.jar com.goldencode.p2j.main.ClientDriver net:server:host=localhost net:connection:secure=false net:server:secure_port=3333 net:server:insecure_port=3433  ./client.xml

No special directory configuration is required to launch the batch process in this manual mode.


© 2004-2021 Golden Code Development Corporation. ALL RIGHTS RESERVED.