Skip to content

Example: Using COMMAND FILE to pause, resume, stop and change THREAD COUNT

Mads Hansen edited this page Jul 28, 2017 · 5 revisions

It is sometimes desirable to be able to pause a long-running CORB job and/or to dynamically adjust the THREAD-COUNT of a CORB job without restarting it. You can configure the job to watch for changes to a Java properties file by setting the COMMAND-FILE option with a file path to monitor.

The COMMAND-FILE does not have to exist when the CORB job is initially started. However, when a CORB job is run with the COMMAND-FILE option configured, CORB will monitor the configured path at a (configurable) time interval, and react to changes. Whenever the COMMAND-FILE is created or changed, CORB will (re)load that properties file and update either the running state based upon the COMMAND value and/or the THREAD-COUNT.

  • If a COMMAND property is specified with any of the values: PAUSE, RESUME, or STOP then the job will change state.
  • If a THEAD-COUNT property is specified, then the CORB job thread pool will grow or shrink to match the value specified.

For example, starting a CORB job with the following options:

XCC-CONNECTION-URI=xcc://user:password@localhost:8202/   
THREAD-COUNT=20    
URIS-MODULE=get-uris.xqy|ADHOC
PROCESS-MODULE=transform.xqy|ADHOC
COMMAND-FILE=/tmp/command.properties

If a job is running with the options specified above and a user wants to pause the execution of the CORB job, a user would need to create(or update) a properties file at /tmp/command.properties:

#allowable commands: PAUSE, RESUME, STOP
COMMAND=PAUSE

After saving the /tmp/command.properties file with the content above, the CORB job will pause execution.

A user might then decide they want to lower the THREAD-COUNT in order to minimize the impact on the MarkLogic database. They would update the COMMAND-FILE and add the THREAD-COUNT property with a lower value, and change the COMMAND from PAUSE to RESUME:

#allowable commands: PAUSE, RESUME, STOP
COMMAND=RESUME
THREAD-COUNT=5

After saving this file, the CORB job will resume and lower the size of the thread pool to 5.