Lesson 2: Set up Alarm Feed with Trigger and Rule
Let's first try the /whisk.system/alarms/interval
feed of the OpenWhisk Alarm Package to fire trigger events on an interval base schedule. To see the effect instantly, we will make it run every minute. You will need a trigger set up with the /whisk.system/alarms/interval
feed, and a rule to wire this trigger to the generic
action created earlier.
The only required param for the interval
feed is minutes
, which is an integer representing the length of the interval (in minutes) between trigger fires. Optional params are trigger_payload
, startDate
and stopDate
.
Copied to your clipboardapplication:actions: actionsweb: web-srcruntimeManifest:packages:my-app:license: Apache-2.0actions:generic:function: actions/generic/index.jsweb: 'yes'runtime: 'nodejs:14'inputs:LOG_LEVEL: debugannotations:final: truetriggers:everyMin:feed: /whisk.system/alarms/intervalinputs:minutes: 1rules:everyMinRule:trigger: everyMinaction: generic
To test the trigger schedule, simply deploy the app again with aio app deploy
, and observe that the action is invoked after 1 - 2 minutes with aio rt activation list
.