Skip to content

Toro Cloud Dev Center


Gloop break icon

Break steps

Break steps in Gloop are a hybrid of the Java break and return keywords. Break steps let you choose where in the service you would like to break from. Break steps use the Expression property to determine where to break from. Some default choices for the expression are:

  • $gloopParent - this will break from the parent of the break step
  • $gloopIterate - this will traverse up the execution stack of the current service until it finds a parent iterate step and break out of it
  • $gloopWhile - this will traverse up the execution stack of the current service until it finds a parent while step and break out of it
  • $gloopService - this will return from the service that contains the break step
  • $gloopAll - unlike $gloopService, this will break from the entire execution stack, basically halting the Gloop service altogether

If Evaluate is false and the value of Expression is anything but the values above, the break step will traverse through its parents (in the current service) and break from the parent whose Label equals the expression. If Evaluate is true, Gloop will run the expression and use the result from it to perform the logic above.

In the example service below, the following will happen when certain values are encountered in the array myArray:

Value Action
hello Break from the fork step at line 3 and then continue at line 9
world Break from the block step at line 2 (since the Label matches) and then continue at line 10
milkyWay Break from the iterate step at line 1 and then continue at line 11
galaxy Return from service altogether, and continue with the service that called this service (if any)
universe Gloop will halt execution of the service and any parent services altogether (similar to a System.exit(0), but only for the service)

Example service with break step

Example service with break step

Break expression auto-complete

If you click on the Expression property in the Properties view in Martini, a drop-down will appear with the valid options for the break step, including parent steps that have labels.

Gloop break expression

Gloop break expression

If you enter an invalid expression for the break step, an error will appear in Martini:

Gloop break step with error

Gloop break step with error