jpkessle commented on a change in pull request #3202: Support action
continuations in the controller
URL:
https://github.com/apache/incubator-openwhisk/pull/3202#discussion_r163054372
##########
File path: docs/compositions.md
##########
@@ -0,0 +1,144 @@
+# Action compositions
+
+Action compositions make it possible to dynamically build and invoke a series
of actions. Action compositions are similar to sequences. However, whereas the
components of a sequence must be specified before invoking the sequence,
components of a composition can be decided as the composition is running.
+
+## Example
+
+Suppose we define an _increment_ action:
+
+```
+$ cat > increment.js
+function main({ value }) { return { value: value + 1 } }
+^D
+
+$ wsk action create increment increment.js
+```
+
+We can use this _increment_ action in a composition as follows:
+
+```
+$ cat > composition.js
+function main(params) {
+ switch (params.$step || 0) {
+ case 0: delete params.$step; return { params, action: 'increment',
state: { $step: 1 } }
+ case 1: delete params.$step; return { params, action: 'increment',
state: { $step: 2 } }
+ case 2: delete params.$step; return { params }
+ }
+}
+^D
+
+$ wsk action create composition composition.js -a conductor true
+```
+
+The key to making this action a composition is the _conductor_ annotation,
which we discuss in the next section.
Review comment:
The key to making the Action a composition is the _conductor_ annotation,
which we discuss in the next section.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services