A powerful feature of the OpenWhisk programming model is the ability to compose actions together. A common composition is a sequence of actions, where the result of one action becomes the input to the next action in the sequence.
Here we will use several utility actions that are provided in the
package to create your first sequence.
- Display the actions in the
- Create an action sequence so that the result of one action is passed as an argument to the next action.
This action sequence converts some lines of text to an array, and sorts the lines.
- Invoke the action:
In the result, you see that the lines are sorted.
Note: Parameters passed between actions in the sequence are explicit, except for default parameters.
Therefore parameters that are passed to the sequence action (e.g.,
mySequence) are only available to the first action in the sequence.
The result of the first action in the sequence becomes the input JSON object to the second action in the sequence (and so on). This object does not include any of the parameters originally passed to the sequence unless the first action explicitly includes them in its result.
Input parameters to an action are merged with the action's default parameters, with the former taking precedence and overriding any matching default parameters. For more information about invoking action sequences with multiple named parameters, learn about setting default parameters.
Large portions of this page is copied from the Apache OpenWhisk documentation on April 23rd 2021 - where there have been customisations to match Hypi's deployment this has been noted. Apache OpenWhisk and the Apache name are the property of the Apache Foundation and licensed under the Apache V2 license .