ISM Manual
  • Overview
  • Features
  • Components
  • Directory Structure
  • Startup/Shutdown
  • ISM Admin UI
    • Dashboard
    • Flow
    • Job
      • Schedule
    • Channel
      • AMQP
      • Mqtt
      • sFTP
    • Interface
      • System
      • Data Structure
      • Field Group
      • Field
    • Web Service
    • Utility
    • Admin
    • Result
  • Tasks
    • Control Task
      • Route
      • Split/Join
      • Mapping
    • FTP
      • FTP Input
      • FTP Output
      • FTP Transfer
    • DB
      • SQL Executor
      • SQL Batch Executor
    • File
      • File Input
      • File Output
      • File Validator
      • Record Extractor
    • Excel
      • Excel Reader
      • Excel Writer
    • Flow
      • Flow Execution
      • Wait Sub
    • Web Service
      • REST Client
      • Web service Client
    • PGP
      • Encrypt
      • Decrypt
    • Cloud
      • SharePoint
      • Amazon S3
      • Google Cloud Storage
    • Others
      • Email Sender
      • LDAP Client
      • Function
      • Script
      • Java Class
  • REST Service
  • Trouble Shooting
  • Logging Configuration
  • Implementing a Task
  • Custom Class
  • Frequently Asked Questions (FAQ)
    • What is XNARUM Integration Service Mastery (ISM)?
    • What is the purpose of XNARUM?
    • Can XNARUM be customized to specific integration requirements?
    • Is XNARUM scalable?
    • Does XNARUM provide support and maintenance?
Powered by GitBook
On this page
  • Input
  • Output
  • Example
  • JavaScript
  • Groovy
  1. Tasks
  2. Others

Function

PreviousLDAP ClientNextScript

Last updated 1 year ago

Function task executes JavaScript or Groovy script.

Input

Attribute
Description

Script Type

JavaScript or Groovy

Function

Script contents

Output

Attribute
Description

ResultValue

The return value from the script, if exists.

UseDataStructure

Map data structure to the return value. This is used at mapping component.

DataStructureId

Data structure id for future mapping.

Example

JavaScript

JDK provides JavaScript engine named Nashorn and this engine is removed since JDK 15. After JDK 15, gravalVM is used as an alternative of Nashorn engine.

And there is a slight change on JavaScript function execution after JDK 8.

Sccript
Result

8

Named function can be executed.

The last function is executed if unnamed function does not exist.

Unnamed function has the highest priority.

9+

Named function cannot be executed.

Unnamed function is executed.

JDK 8

Sccript
Result

function hello () {

return "Hello";

}

Hello

function () {

return "Hello";

}

Hello

function add(a,b) {

return a + b;

}

function a () {

return add(1,2);

}

3.0

function a(a, b) {

return a + b;

}

function () {

return a(1,2);

}

function b() {

return "Hello";

}

3.0

JDK 9+

Sccript
Result

function hello () {

return "Hello";

}

Error

function () {

return "Hello";

}

Hello

function add(a,b) {

return a + b;

}

function () {

return add(1,2);

}

3

Groovy

This is the definition of Groovy (from Wikipedia)

The example script of Groovy is like this.

def func() {
    return "Hello";
}
return func();

Apache Groovy is a -syntax-compatible for the . It is both a static and language with features similar to those of , , and . It can be used as both a and a for the Java Platform, is compiled to (JVM) , and interoperates seamlessly with other Java code and .

Java
object-oriented
programming language
Java platform
dynamic
Python
Ruby
Smalltalk
programming language
scripting language
Java virtual machine
bytecode
libraries