You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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 in the output of hello.yaml) 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 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

Kurator-Akka includes a StringAppender actor tjat adds a configurable suffix to each string it receives and outputs the modified strings. Add a new component to your workflow file (it may be easiest to copy and paste the GreetingSource component).  It doesn't matter where you add the component, as it is somewhere in the components section of the file.  Give the new component an id of GreetingEmphasizer and a type of StringAppenderStringAppender actors take 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.  Configure the workflow component to include GreetingEmphasizer

The workflow component includes a list of actors to be included in the workflow.  Add a reference to GreetingEmphasizer to that list.

6. Make the emphasis added by GreetingEmphasizer configurable by the user

 

 

 

 

 

 

 

 

 

  • No labels