/
Script Processor

Script Processor

This processor allows the execution of custom scripts.

Configuration

{
  "type": "script-processor",
  "name": "Scripting",
  "description": "Description about script",
  "labels": {},
  "active": true,
  "config": {
    "language": "groovy",
    "script" : "println \"RECORD (Groovy):\" + data\nout.put(\"data\", \"data-\"+data.findField(\"c2:/contentId\").get().asText())\nout.put(\"record\", \"record-\"+record.id)\nprintln \"NEW:\" + out"
  }
}

Configuration Parameters

language (Required, String) Code scripting language. Options are: groovy, javascript and jython.

script (Required, String) code to process each record.

name (Required, String) component name.

description (Optional, String) description about component.

Data Cache

The Data Cache is a simple Map<String, Object> structure shared with all jobs in the same seed execution.

Usage

def cachedValue = cache.computeIfAbsent("key") { key -> ~"([Gg])roovy" }
if (data.getId() =~ cachedValue) {
  // Do something with the match
}

©2024 Pureinsights Technology Corporation