Skip to content

Overview

Concepts and Principles

Development

Overview

IDEs

API Explorer

Releases

Release Notes

TORO Integrate

Coder Studio

Coder Cloud

Bug Reports

Search

Groovy Services

Groovy Services are one of the primary types of services in TORO Integrate. As the name implies, these services are defined using Groovy. Groovy Services refer to Groovy methods.

Groovy Services are ideal for creating low-level instructions. In terms of code, Groovy offers great flexibility – what you can't do in Gloop, you can most likely do in Groovy. The caveat, however, is that you must be familiar with programming concepts and the language itself.

You can write Groovy Services in the form of Groovy scripts or Groovy methods within Groovy classes.

Here's a sample Groovy class. When called, the sayHello() method prints Hello, world! to the console. The sayHello(String) method, on the other hand, prints Hello, $name! to the console where the name argument substitutes $name in the GString.

1
2
3
4
5
class Greeter {
    void sayHello(String name = 'world') {
        println "Hello, $name!" 
    }
}

Here's a sample Groovy script. It prints Hello, world! to the console when run.

1
println "Hello, world!"

Like Gloop Services, Groovy Services can use one-liners which help make integrations easier to build. For example sending a JMS message can be done simply by:

1
2
3
public void sendMessage(String destination, String message) {
    destination.publishString(message)
}

Example Services

TORO Integrate comes bundled with an examples package that contains many code snippets and working services to help get you started, including Groovy code samples.