Transformer Pipeline Module API Reference (JavaScript)  8.0.2.290852-a608fcd3
Configuration: Pipeline Threads Selector

The thread selector configuration allows a user to select the thread a symbol will be processed on. Use thread-selector-file to configure the name of a pipeline 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 Wed Jul 31 2024 18:00:29 for Transformer Pipeline Module API Reference (JavaScript)