Skip to content

Home

Introduction

Development

IDEs

Services

Service manager

API Explorer

Groovy service inputs and outputs

The signature of a Groovy method indicates expected service inputs and output.

Injectable arguments

When a service is made invokable via HTTP or used in an Integrate endpoint, additional input variables can be injected for further use. All you need to do is declare the input variables needed by your service and ensure they are named accordingly. TORO Integrate won't inject arguments for parameters which do not follow expected parameter names.

Example injectable input variables are:

There are multiple other injectable arguments. In Groovy, they include the following:

Injecting arguments in scripts

Since Groovy scripts don't have declared inputs or outputs, TORO Integrate will place all the available data in a binding for you. It will execute your Groovy script with the binding, giving it access to all variables. Below is a simple piece of code that logs the HTTP request object to the Integrate logger at the INFO level:

1
"Hello, world! The request used to invoke me is ${request}.".info()

Injecting arguments in methods

Unlike Groovy scripts, Groovy methods declare their input variables. To do something similar to the Groovy script example earlier, declare the variable as a parameter. For example, the method below publishes the string to a JMS queue.

1
2
3
void helloWorld(HttpServletRequest request) {
    "Hello, world! The request used to invoke me is ${request}.".publishTo('queue://my.jms.HTTPQueue')
}