Batch Processing Service

Introduction

The JSLEE allows for directories to be watched for file input. Targeted directories will be polled regularly for input, and files inside matching the criteria will be sent for processing to other JSLEE endpoints.

To include a batch service in your JSLEE, configure the handler as follows:

"provisioning": {
  "handler": "nz.co.nsquared.slee.daemon.DirectoryWatcherVerticle",
  "instance-count": 1,
  "configuration": {
    "targets": [
      {
        "name": "subscriber-input",
        "monitor-directory": "/var/tmp/jslee_input",
        "handler-address": "business-logic",
        "file-suffix": "json"
      }
    ]
  }
}

Configuration Parameters

Core Configuration

The batch processor service has only one core configuration element, targets. This element must be an array of targets to monitor.

Target Configuration

Each target to monitor must have the following mandatory items configured:

Parameter Type Description
name String The unique name to refer to this target by.
monitor-directory String The path to the directory for this target to monitor.
handler-address String The name of the service to send files found for this target.

Each target to monitor may also have the following optional items configured:

Parameter Type Required Default Description
processed-directory String No monitor-directory The path to write files that have been sent for processing successfully. If not specified, sent files will be written to the monitor-directory with the processed-suffix.
processed-suffix String No .processed The suffix to append to processed files.
error-directory String No monitor-directory The path to write files that encountered errors during reading or processing. If not specified, errored files will be written to the monitor-directory with the error-suffix.
error-suffix String No .error The suffix to append to errored files.
file-prefix String No (empty string) A regular expression to test against the prefix of files found in monitor-directory. Only files with the matching prefix will be considered for processing.
file-suffix String No (empty string) A regular expression to test against the suffix of files found in monitor-directory. Only files with the matching suffix will be considered for processing.
poll-seconds Integer No 10 The number of seconds between polls of the monitor-directory.