This tutorial tests your understanding of the previous one (Tutorial 3 - YAML workflow definitions) by asking you to modify a workflow to incorporate additional functionality. The goal will be update hello.yaml to make the emphasis in the greeting (the exclamation point) configurable by the user of the workflow.
1. Start from the contents of hello.yaml
Copy the contents of hello.yaml
(or copy from the workflow definition immediately below) into a new text file and save it with a new name, e.g., hello_emphasized.yaml
. Your file should now contain the following.
imports:
- classpath:/org/kurator/akka/actors.yaml
components:
- id: GreetingSource
type: ConstantSourceActor
properties:
parameters:
value: Hello World!
- id: GreetingPrinter
type: PrinterActor
properties:
listensTo:
- !ref GreetingSource
- id: HelloWorldWorkflow
type: Workflow
properties:
actors:
- !ref GreetingSource
- !ref GreetingPrinter
parameters:
greeting:
actor: !ref GreetingSource
parameter: value
2. Remove the emphasis from the default greeting
The first thing to do is to remove the exclamation point from the default value for GreetingSource. Update the value parameter of GreetingSource so that default value assigned to the value parameter is simply 'Hello World!' (the single quotes are optional).
3. Add a new actor for appending emphasis
The StringAppender
actor adds a configurable suffix to each string it receives and outputs the modified strings. Add a new component to workflow file (it may be easiest to copy and paste the GreetingSource
component). Give the new component an id
of GreetingEmphasizer
and a type
of StringAppender
. A StringAppender
takes a parameter called suffix
. Edit your GreetingEmphasizer
component to make a single exclamation point the default suffix (enclose the exclamation point in single quotes). Finally, add a listensTo
property to GreetingPrinter
and configure the component to receive its input from GreetingSource
.
4. Reconfigure GreetingPrinter to receive the emphasized greeting
In hello.yaml, GreetingPrinter receives the string that it prints directly from GreetingSource. Modify the configuration for GreetingPrinter so that it now receives the emphasized greeting from GreetingEmphasizer instead.
5. Add GreetingEmphasizer to the list of actors in the workflow