Class: Processor
Properties
arguments
arguments:
object
Returns arguments which you have configured via the UI as part of a Javascript Asset. The list of provided arguments are in JSON-Format. You enter them using the Javascript Asset editor and then retrieve them using this method.
Example
// Get the Processor's configured arguments:
const args = processor.arguments;
// Now access the individual arguments like this:
let myProp = args.myProp;
name
name:
string
Get the name of the current Processor. Same as getName
Example
// Get the Processor's name:
const name = processor.name; // Returns the name of the Processor, e.g. 'My-Processor'.
Methods
expandString()
expandString(
toExpand
):string
Expands all macros contained in a string.
For example, if you want to use the USERNAME
environment variable, which you have defined in an Environment Resource you can do so like this:
Parameters
• toExpand: string
Returns
string
Expanded string
Example
// Get the username which is defined in one of your environment resources:
let username = processor.expandString('The username is ${lay:USERNAME}.');
// Output: "The username is layline.", where "layline" is the value of the USERNAME environment variable.
Check out the macro documentation for more information on how to address expandable strings.
getArguments()
getArguments():
object
Returns arguments which you have configured via the UI as part of a Javascript Asset. The list of provided arguments are in JSON-Format. You enter them using the Javascript Asset editor and then retrieve them using this method.
Returns
object
Configured arguments as a Javascript object
Example
// Get the Processor's configured arguments:
const args = processor.getArguments();
// Now access the individual arguments like this:
let myProp = args.myProp;
getName()
getName():
string
Get the name of the current Processor. Same as name
Returns
string
Processor name
Example
// Get the Processor's name:
processor.getName();
getOutputPort()
getOutputPort(
portName
):OutputPort
Get the OutputPort information for a given output port.
Parameters
• portName: string
Returns
Output port instance information.
Example
// Set stream output name:
let OUTPUT_PORT = processor.getOutputPort('Output'); // Returns the OutputPort instance for the output port named 'Output'.
logError()
logError(
msg
):void
Logs a message with Severity.ERROR to the processor log. You can view this both via the Audit Trail in the UI and output in the process terminal output.
Parameters
• msg: string
Information you want to log.
Returns
void
Example
processor.logError('Ran into the following problem: ' + problem);
logFatal()
logFatal(
msg
):void
Logs a message with Severity.FATAL to the processor log. You can view this both via the Audit Trail in the UI and output in the process terminal output.
Parameters
• msg: string
Information you want to log.
Returns
void
Example
processor.logFatal('Ran into the following problem: ' + problem);
logInfo()
logInfo(
msg
):void
Logs a message with Severity.INFO to the processor log. You can view this both via the Audit Trail in the UI and output in the process terminal output.
Parameters
• msg: string
Information you want to log.
Returns
void
Example
processor.logInfo('Here is some interesting information: ' + info);
logWarning()
logWarning(
msg
):void
Logs a message with Severity.WARNING to the processor log. You can view this both via the Audit Trail in the UI and output in the process terminal output.
Parameters
• msg: string
Information you want to log.
Returns
void
Example
processor.logWarning('Here is a warning: ' + warning);