Job Action Service

   Journey Manager (JM) The transaction engine for the platform.  |    System Manager / DevOps  |  All versions This feature is related to all versions.

Manager allows you to create and configure job action services. When a collaboration job's action is processed, an action service is run. A collaboration job usually specifies an action service from one of the available inbuilt action services. This allows a developer to create their own job action and job expiry services using GroovyGroovy is a powerful scripting language which runs on the Java Virtual Machine. Across theTemenos Journey Manager platform, Groovy is used to create services in Manager. These services are primarily used to create plug-in style systems that interact with Manager. scripts.

To create a job action service:

  1. Select Services > Job Services.
  2. Click New to create a job service.
  3. Select the Job Action as a service type from the Service Type dropdown list.
  4. Click Save to update the changes.

To configure a job action service:

  1. Locate a job action service.
  2. Configure the service definition.
  3. Select the new service type to assign a Fluent or Groovy job action to a new type, such as Job Expiry Service or Job Task Wait.
  4. Configure the job definition. You can configure an action to call a Groovy service from a job controller, as shown below.
    "actions": [
      {
          "name": "Individual Tasks",
          "type": "Job Task Assign",
          "properties": [
             { "name": "Task Assign Repeating",  "value": "true" },
             { "name": "Task Assign Repeat Item",  "value": "$func.invoke('Repeating Get Item', ${formDataMap.itemDelimited}, ${assignRepeatIndex})" },
             { "name": "Task Type",  "value": "Review" }
          ]
       }
  5. The $func.invoke method executes the Repeating Get Item service (invoking it by the name) with two parameters.

    If you want to invoke same job action multiple times as part of single step, give them different job action names, for example, "name": "Individual Tasks 2", but define the same service name, for example,"serviceName": "Repeating Claimable". If you do not define the service name explicitly, it expects the job action name to match the service name. It's not allowed to have 2 or more job actions with the same name in one job step.

  6. Click the Job Services tab to view the Repeating Get Item service used in the action definition.
  7. Click on the service name to open this service's Groovy script.
    import com.avoka.tm.util.*
    import com.avoka.tm.vo.*
    import groovy.transform.TypeChecked
    import javax.servlet.http.*
    import org.apache.commons.lang3.StringUtils
    
    @TypeChecked
    class FluentGroovyService {
    
        // Injected at runtime
        public Logger logger
    
        /*
         * Perform a groovy service invocation
         *
         * return: the result object
         */
        Object invoke(SvcDef svcDef, HttpServletRequest request, User user, Map params) {
            JobAction jobAction = (JobAction) params.jobAction
            return invoke(svcDef, request, user, jobAction, params)
        }
    
        Object invoke(SvcDef svcDef, HttpServletRequest request, User user, JobAction jobAction, Map params) {
            logger.info params
            List<String> args = (List<String>) params.args
    
            def result = "Not Found"
    
            if( StringUtils.isNotEmpty(args[0]) &&
               StringUtils.isNotEmpty(args[1]) &&
               args[1].isNumber()) {
                def itemDelimited = args[0]
                // note repeat index from TM is 1 based not 0 based
                def repeatIndex = args[1].toInteger() - 1
                logger.info "itemDelimited: " + itemDelimited
                logger.info "repeatIndex: " + repeatIndex
    
                def items = itemDelimited.tokenize('|')
                logger.info "items: " + items
    
                result = items[repeatIndex.toInteger()]
                logger.info "result Item: " + result
            }
    
            return result
    
        }
    }
  8. Click Save to update the changes.
Download

You can download the complete code example here.

Next, learn how to view all job services.