Yesterday, we discovered the UI of Cloud Workflows. We created our first workflow. We started with a single step, returning a greeting message:
- sayHello: return: Hello from Cloud Workflows!
A workflow definition is made of steps. But not just one! You can create several steps. In YAML, the structure of your workflow will be something like:
- stepOne: # do something - stepTwo: # do something else - sayHello: return: Hello from Cloud Workflows!
By default, steps are executed in the order they appear, from top to bottom. The execution will finish when either you return a value, or you reach the final step. If there’s no return statement, a null value is returned as result of the workflow execution.
A small step for a workflow execution, but you can also do a jump between steps! For that, you’ll use the next instruction:
Here, we jump between steps, back and forth, before going to the final step that will return a value, and thus finish the execution of our workflow.
Of course, we can go beyond a linear series of steps, and in subsequent articles, we’ll see how we can create conditional jumps and switches, for more complex logic, and how we can pass some data and values between steps.
Guillaume Laforge is blogging here about whatever comes to his mind,
but mostly about technology, and especially topics related to
the Groovy dynamic language,
the Gaelyk lightweight toolkit
for developing applications for Google App Engine,
and all the other cool things in the Java and Groovy ecosystem.