Skip to content

Home

Introduction

Development

Overview

IDEs

Services

Service manager

API Explorer

Setting the action for a state

A workflow with transitions between action-less states won't do much. In fact, it won't do anything at all. Actions tell states what to do and by default, states are configured to map via map steps. Map steps in Flux work the same way they do in Gloop services – their main purpose is to transform data, and in this case, data between states. Aside from mapping, you can have a state call another service instead. In Flux, you can invoke any type of service that Gloop services can invoke because underneath the covers, the Flux engine uses Gloop.

Now, let's create a state invoking a Groovy service. For this example, we'll set them to call Groovy methods that print something to the terminal.

  1. Select the state whose action you want to re-specify. You'll know the state has been selected when its circle's color has changed.
  2. Press to trigger content assist. By doing so, you will be given a list of available services that you can call from the state.
  3. Select the service you want to invoke. For this example, we'll select String LoggerMethods.println(String).
  4. Under the Mapper view, you'll see that you have the ability to set the values of the arguments you will be feeding to the selected service. Do this if you need to.

    For this example, we'll set the value of message by double clicking the parameter shown in the view. We'll do this for our first and second states.

Here's a demonstration of the steps above:

Setting a Flux state's action

Setting a Flux state's action

And just like that, you already have a workflow that transitions from one step to another executing an action at each step. Albeit simple, this example demonstrates how easy it is to get started on creating workflows. Of course, you'd like to create something more powerful. Let's continue by being able to set the message through an input.

Creating a state with action and transition

To quickly create a state with an action and transition, drag a transition to a blank part of the canvas. This will show dialogs for creating them and for setting the action.

Creating state with action and transition

Creating state with action and transition

Use template proposals to set property set expressions

You can set the expressions of properties in states or transitions using template proposals:

  1. Select the state or transition.
  2. Press the key; a pop up will show with proposals.
  3. Select the Set expression proposal.
  4. If the state's action is an invoke step, there will be an Input or Output proposal that will pop up after; select either Input or Output. Otherwise, ignore this step.
  5. Select the property whose expression must be set.
  6. The Expression dialog will appear; enter the expression. Your expression can either be a plain string or Groovy code (in which the expression must be evaluated).
  7. Click the OK button or press to save the expression.

Setting property expressions using content assist

Setting property expressions using content assist