Martini Services Break Step
Overview
Break steps are similar to a combination of the break and return keywords found in traditional programming languages. They allow you to specify a point within a service from which to exit. The exit point is determined by the Expression property.
Default Expression Choices
$parentStep- Exits from the parent of the break step.$iterateStep- Searches the execution stack for a parent iterate step to exit from.$whileStep- Finds a parent while step in the execution stack and exits from it.$serviceStep- Returns from the current service.$allStep- Exits from the entire execution stack, effectively stopping the current service.
Conditional Breaking
- Without Evaluation: If
Evaluateis set tofalseand theExpressionvalue is not one of the defaults, the break step will search through parent steps in the current service and exit from the step whose label matches the expression. - With Evaluation: If
Evaluateis true, the expression is executed, and its result determines the exit logic as per the rules above.
Example Usage
In the example below, various actions are triggered based on different values encountered in myArray:
| Value | Action |
|---|---|
hello |
Exits from the fork step at line 3, continuing at line 9. |
world |
Exits from the block step at line 2 (label match), continuing at line 10. |
milkyWay |
Exits from the iterate step at line 1, continuing at line 11. |
galaxy |
Exits the service entirely, resuming the calling service (if any). |
universe |
Halts execution of the current service and all parent services (analogous to System.exit(0)). |
Auto-Completion for Break Expression
In the Martini interface, clicking on the Expression property in the Properties view displays a dropdown with valid options for the break step, including labeled parent steps. Inputting an invalid expression triggers an error notification in Martini.