Script

With the Script Function you can execute custom functionalities using JavaScript. It can be used to create processors that run specified operations on the input data. Any syntax error will lead to stream failure. 

There are two tabs in the Script configuration: Transform and Flush.

In the Transform tab, enter the executed code for each incoming record/payload and in the Flush tab, enter the code to be executed at the end of the transaction. 

Below is an example of the Script configuration screen:


 



Note

If you have a real-time or unbounded stream, for example, a stream using an HTTP Server, the code in the Flush tab is not called at all.

To make JavaScript coding easier, automatic code completion provides you with context-sensitive proposals. The error results in the preview Log tab provides additional information on any detected issues.

NPM Libraries

The Script Function supports the following npm libraries:

  • uuid/v4

  • moment

  • lodash

  • fast-xml-parser

See Example npm Libraries for examples of these npm libraries.

This section includes: