Skip to content

Home

Introduction

Development

IDEs

Services

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

Gloop icon

Invoke steps

The invoke step is used to invoke other Gloop services, Flux services, and compatible Java and Groovy services1 in Gloop. It borrows the Mapper view from the map step, meaning you can also set variable values, declare new variables, or unload them in invoke steps. This makes Gloop infinitely more powerful, because if there's anything you can't do in Gloop, you can do it in Flux, Java, or Groovy! This also means that you can reuse existing services by wrapping them in invoke steps in Gloop services to make managing your services and APIs easier.

The Mapper view for invoke steps has two mappers inside it. One is for mapping input variables (on the left hand side) for the service/code it will invoke, and the other is for mapping output variables from the invoked service (on the right hand side).

An invoke step's mappings, as seen in the Mapper view

An invoke step's mappings, as seen in the Mapper view

Mapper for invoke steps

When an invoke step is selected in the Gloop service editor, the Mapper view in Martini will show all of the available input and output variables for the service to be invoked, as well as the variables available in the current scope of the service. This is where you map variable values from the current scope of the service to the service to be invoked and add set expressions to the inputs of the service to be invoked. After the service has been invoked, Gloop will then map and set all of the variables on the Output side of the Mapper view.

For example, the mapper screenshot below:

Example invoke step's mappings shown in Mapper view

Example invoke step's mappings shown in Mapper view

... is the same as the following Groovy code:

1
2
3
4
5
6
// Invoke some code.
GloopModel output = TrackerMethods.searchTracker(trackerQuery, externalIds, documentTypeId, 'Error', 'CustomerX', 'Togo', 'now', null, null, null, null, null, 100, 2)
// Declare the searchResult variable and map (set) it.
GloopModel searchResult = output.searchResult
// Declare the numberOfResults variable and map (set) it.
int numberOfResults = output.searchResult.numFound

Annotating code to make it Gloop-friendly

Gloop has a nifty set of annotations that are used to decorate Groovy and Java code with metadata to make your code look even better in the Gloop UI (and easier to use whilst writing Gloop services).

Adding invoke steps

There are two ways to add an invoke step to your Gloop service:

  • Drag and drop the service you want to invoke from the Navigator view.
  • Use Martini's auto-complete feature (activated by pressing in the Gloop service editor), then start typing in the name of the service you want to invoke. Once you find your selection in the list, click on it or use the cursor keys to highlight it and then press .

Below is a GIF showing both ways:

Adding an invoke step to a Gloop service

Adding an invoke step to a Gloop service

Map and declare in one go!

If you would like to map the output of an invoke step to a new variable, simply drag the variable to the output tree, whilst holding . This will declare the variable and map it for you in one step!

Declaring and mapping in one step

Declaring and mapping in one step

Opening a service used by an invoke step

You can open the service called by an invoke step by right-clicking the invoke step from the Step editor > Open Declaration. Another option is to press on the selected step to do the same. You can also do this using the Open Declaration button in the Properties view, which appears when the invoke step is selected.

If the service called is from the core package, then Martini will only show the service in the Navigator view.

Opening a referenced service from the Properties view


  1. For a Java or Groovy service to be compatible, the method needs to be public static