rabbah commented on a change in pull request #3202: Support action
continuations in the controller
URL:
https://github.com/apache/incubator-openwhisk/pull/3202#discussion_r165250219
##########
File path: docs/compositions.md
##########
@@ -4,38 +4,44 @@ Action compositions make it possible to dynamically build
and invoke a series of
## Example
-Suppose we define an _increment_ action:
+Suppose we define an _increment_ action in a source file `increment.js`:
-```
-$ cat > increment.js
+```javascript
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:
+We create the action _increment_:
```
-$ cat > composition.js
+wsk action create increment increment.js
+```
+
+We can use this _increment_ action in a composition. We create a source file
`composition.js`:
+
+```javascript
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
+```
+
+We create the composition action:
-$ wsk action create composition composition.js -a conductor true
+```
+wsk action create composition composition.js -a conductor true
Review comment:
since the examples are using the value `true`, i think there is a reasonable
expectation that the value matters.
hence, the reason for the suggested change in the controller logic.
----------------------------------------------------------------
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