Batch Components

The parameters in the Batch Definition editor correspond to components contained in the Batch Definition. Each Batch Definition can contain one or more Batch components. These components can be commands, events, or other Batch Definitions. For example, a LogCommand Component is shown below. To add a component to a Batch Definition, select a component from the add component list.

A Batch Component

Batch components are processed in a Batch Definition in order when Batch Type, described above, is set to serial. You can change the order of Batch components by clicking the Move Up and Move Down buttons in the upper-right corner of each Batch component, to move that component’s order up or down in the Batch Definition. You can also remove a Batch component by clicking the Remove button in the upper-right corner.

Each of the types of Batch components that can be added to a Batch Definition are described below. By default, Extended Help is displayed. Using the help control in the upper right corner, you can select Help to display only the first sentence of help, or No Help to suppress the help display.

Batch Components

Name

Description

Batch

Contains another Batch Definition. This can be used to create a complex or multi-leveled Batch Definition. For example, a parent Batch Definition can start each day, starting with two child Batch Definitions, each with different schedules or conditions.

For each new Batch component, you must set the same parameters for a Batch Definition as described above. You can then add additional components to the Batch.

Conditional

Provides conditional processing when running Batches. The component specified by the test is run. If it runs successfully, the component specified by success is executed. If it fails, the component specified by failed is executed.

The component specified in test returns success in the following conditions:

Command returns Command.SUCCESS
ServiceCommand creates the Service and submits the invocation without exception
ServiceRunnerCommand creates the Service and submits all invocations without exception

BatchReference

Contains a reference to a registered Batch Definition that gets loaded when scheduled from the Batch Registry.

Command

Runs an implemented method in a deployed class. Properties in Batch commands are based on the Java Beans specification. In a Java class, you define methods which match a pattern to get and set property values. For example, if you have a property called MyName, you can define two methods:

Public class MyCommand implements Command { 
     public void setMyName(String value) { MyName = value; }
public String getMyName() { Return MyName; }
public int run()
     {
          ; //do stuff
          return Command.SUCCESS;
     }
}

On the Batch Registry page, adding this command to a Batch, you can then add a property with the name MyName and value Bob by entering these in the two text fields and clicking Add property.

ServiceCommand

Starts a Service. You can specify a Service type registered on the Manager and method name to run. You can also specify a Service reference ID (this enables you to reference the Service from another Service Command), Service action, and input and init data for the Service. Data is comma-delimited.

You can add ServiceDescription, ServiceOptions, and Discriminator components to a Service by using a Service Runner.

ServiceRunnerReference

Loads the specified registered Service Runner. See below for information about registering a Service Runner.

AdminCommand

Executes a command via the GridServer Admin API. For more information about using the Admin API, see the GridServer Developer’s Guide.

EmailCommand

Sends an email message from a Batch Definition, for notification or alerts. You can enter a comma-delimited list of email addresses for recipients, and a message string, used as a subject and a body.

Note that for the batch processor to send email, you must define an SMTP server and Contact Address in your Manager Configuration. To do this, go to Admin > Manager Configuration > Admin, and enter values for SMTP Host and Contact Address under the Mail heading. Email sent by the batch processor is sent from the Contact Address.

EmailFilesCommand

Sends an email message from a Batch Definition that includes files as attachments, typically used to send the output of a previous command by saving that output to a file. You can enter a subject, a message body string, a comma-delimited list of email addresses, and a semicolon-delimited list of files, which are sent as attachments in the message.

The setup rules given above in the description of the EmailCommand component also apply to the EmailFileCommand component.

ExecCommand

Executes a command from a Batch. This executes a command from the application server’s root directory. You can set an input, output, and error file, plus a log file for the command to be run.

LogCommand

Writes a string to the Manager log. This is useful for testing Batches or indicating when a Batch is starting or stopping.

WaitCommand

Halts for a moment before proceeding. The amount of wait time is specified in seconds. Note that this component is only useful for generating a wait time when the Batch type is serial.

EngineWeightCommand

Sets the Engine distribution weighting relative to other Brokers. Only Brokers that are part of a Broker/Director Manager installation are listed.

Event

Makes a Batch File wait for an implemented event to take place. You can use this to pause until a specific condition in a class you deployed has occurred.

FileEvent

Makes a Batch wait for a file event to occur to the specified file before completing the remaining items in the Batch Definition. Specifically, it enables you to watch a file and wait until it is created, deleted, or modified before proceeding.

The file specified in FileEvent supports wildcards in the base filename. Any file matching the wild card rule can trigger the file event. Wildcards supported include *, to match the rest of the base filename, and ?, to match one character in the base filename. The wildcard naming role is the same as what’s implemented by org.apache.commons.io.filefilter.WildcardFilter (see http://jakarta.apache.org/commons/io/api-release/index.html for more information.)