Class FluentFuncInvoker

java.lang.Object
com.avoka.tm.svc.FluentFuncInvoker

public class FluentFuncInvoker extends Object

Provides a Fluent Function Invoker class for executing 'Fluent Function' types services. Please note this class does not support invoking 'Delivery Functions' as these need to be executed by internal TM services to ensure the transaction state transitions are managed correctly.

Examples

Please find the fluent function invoker examples below.

Executing in a Form Function

The example below illustrates calling a Fluent Function inside another function handler. Please note how you can simply pass the FuncParam parameter into the function being called and return the resulting FuncResult object.

 import com.avoka.tm.func.*
 import com.avoka.tm.util.*
 import com.avoka.tm.vo.*
 import jakarta.servlet.http.*

 class FluentFunction {

     public Logger logger

      // Perform Fluent Function call.
     FuncResult invoke(FuncParam param) {

         FuncResult result = new FluentFuncInvoker()
             .setServiceName("Account Verification")
             .setVersion("1.0.1")
             .invoke(param)

         return result
     }
 } 

Please Note: if the service version number is not specified then the service for the transaction organization, service name and current version will be resolved.

Since:
17.10.0
  • Constructor Details

    • FluentFuncInvoker

      public FluentFuncInvoker()
  • Method Details

    • setServiceName

      public FluentFuncInvoker setServiceName(String serviceName)
      Set the function service name to invoke.
      Parameters:
      serviceName - the function service name to invoke (required)
      Returns:
      the fluent function invoker
    • setVersion

      public FluentFuncInvoker setVersion(String version)
      Set the function version to invoke.
      Parameters:
      version - function version to invoke (required)
      Returns:
      the fluent function invoker
    • setLogger

      public FluentFuncInvoker setLogger(Logger logger)
      Set the function logger.
      Parameters:
      logger - the function logger
      Returns:
      the fluent function invoker
      Since:
      17.10.3
    • invoke

      public FuncResult invoke(FuncParam funcParam)
      Invoke the fluent function and return the function result.
      Parameters:
      funcParam - the function parameter
      Returns:
      the function result