Transformer Pipeline Module API Reference (JavaScript)  7.1.1.311110
Configuration: Pipeline Threads Selector

The thread selector configuration allows a user to select the thread an symbol will be processed on. Use thread-selector-file to configure the name of a pipeine file which should contain the function configured in thread-selector-func. The pipeline file should be placed on the pipeline path pipeline-paths.

The function will be called with the symbol name and the configured number of pipeline threads num-threads. The function should return the thread the symbol should be processed on. If -1 or a value greater than num-threads is returned, default thread selection is used. Below is an example thread-selector-func. It assumes a symbol which is of the form "/THREAD/<digits>"

var log = require("log");
// Select the thread number based on the number in the subject
// The subjects to be selected are /THREAD/<thread number>
function select_thread(subject, num_threads)
{
if ( subject.indexOf("/THREAD") == -1 ) {
log.log(log.INFO, "Not selecting thread for <" + subject + "> num_threads " + num_threads + "\n");
return (-1);
}
// Get the number part of the subject
var thread = subject.replace("/THREAD", "");
var thread_num = parseInt(thread,10) % num_threads;
log.log(log.INFO, "Selecting thread " + thread_num + " for <" + subject + "> num_threads " + num_threads + "\n");
return (thread_num);
}

thread-selector-file

Type: String
Default: None

Pipeline file to execute to select thread


thread-selector-func

Type: String
Default: None

Pipeline function to execute to select thread



Generated on Fri Mar 23 2018 18:29:30 for Transformer Pipeline Module API Reference (JavaScript)