cat hello.js
function main() {
return {payload: 'Hello World'};
}
packages:
helloworld:
actions:
helloworld:
location: src/hello.js
runtime: nodejs:6
outputs:
payload:
type: string
description: a simple greeting message, Hello World.
application:
name: SampleHelloWorld
namespace: _
packages:
helloworld:
actions:
helloworld:
# ls -1R ~/SampleHelloWorldApp/
deployment.yaml
manifest.yaml
src/
./src:
hello.js
# wsk action invoke --blocking --result helloworld/helloworld
{
"payload": "Hello World"
}
function main(params) {
return {payload: 'Hello, ' + params.name + ' from ' + params.place};
}
packages:
helloworld:
actions:
helloworld:
location: src/hello.js
runtime: nodejs:6
inputs:
name:
type: string
description: name of a person
place:
type: string
description: location of a person
outputs:
payload:
type: string
description: a simple greeting message, Hello World!
packages:
helloworld:
actions:
helloworld:
location: src/hello.js
runtime: nodejs:6
inputs:
name: Amy
place: Paris
outputs:
payload:
type: string
description: a simple greeting message, Hello World!
application:
name: SampleHelloWorld
namespace: _
packages:
helloworld:
actions:
helloworld:
inputs:
name: Amy
place: Paris
wsk action invoke --blocking --result helloworld/helloworld
{
"payload": "Hello, Amy from Paris"
}
wsk activation poll
Enter Ctrl-c to exit.
Polling for activation logs
wsk trigger fire locationUpdate
ok: triggered locationUpdate with id 4c3a8b1792d546a68ac58538c3f5d637
Activation: helloworld (d545c458f3d34d6fbf5c29173be3d29e)
[]
Activation: locationUpdate (4c3a8b1792d546a68ac58538c3f5d637)
[]
Activation: helloworldOnLocationUpdate (c099355c1f1f4d6d8d30f54e8dac2b84)
[]
wsk activation get d545c458f3d34d6fbf5c29173be3d29e
ok: got activation d545c458f3d34d6fbf5c29173be3d29e
{
...
"activationId": "d545c458f3d34d6fbf5c29173be3d29e",
"start": 1489444142544,
"end": 1489444142598,
"response": {
"status": "success",
"statusCode": 0,
"success": true,
"result": {
"payload": "Hello, Amy from Paris"
}
},
...
}