JavaScript Executor
An Executor can be implemented using the JavaScript/ECMAScript language (JS). In that case, you will create a Configuration of type "Java Script" from the Administration UI.
The content of the configuration will then contain the JavaScript code that performs the Job execution logic.
The JavaScript (JS) code is executed in a sandboxed Java Virtual Machine.
The syntax of the code you write must conform to the ECMAScript 2024 specification, aka the 15th edition. Just because the code is following the JavaScript syntax, do not expect the same APIs are available as when you develop code for being executed in a browser or in a Node based application. For example, the 'fetch' API or the 'XMLHttpRequest' API. The available APIs in context of TIF Cloud are described on the following page(s). |
The Context
When implementing the Executor logic using JS, the script will be bound with a "global variable" called context, which is a Java object of type com.technia.tias.executor.api.ExecutionContext
.
This context variable is used to access all services and APIs that are available during the execution of the job. From this context object, you will also be able to access any input parameters and/or data passed in to the Job.
Depending on how the job is being triggered, e.g. through any of the below mechanisms:
The kind of input data will vary, and thus the code will use some different API to collect required input data/parameters. |
The API documentation for this API is available in two formats, traditional Javadocs or in a format better suited for JavaScript development.
There is also a TypeScript definition file available that describes the API. This TypeScript is generated from the API documentation, but adapted for TypeScript.
From the Marketplace in the Administration UI, there is an extension available that contains examples of how to use the JS API of TIF Cloud. You can easily install these and use for learning purposes. Later on, these can be uninstalled equally easy as they were installed. |