Edit in GitHubLog an issue

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 clipboard
application:
actions: actions
web: web-src
runtimeManifest:
packages:
my-app:
license: Apache-2.0
actions:
generic:
function: actions/generic/index.js
web: 'yes'
runtime: 'nodejs:14'
inputs:
LOG_LEVEL: debug
annotations:
final: true
triggers:
everyMin:
feed: /whisk.system/alarms/interval
inputs:
minutes: 1
rules:
everyMinRule:
trigger: everyMin
action: 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.

activation-list

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.