Using Feeds

Feeds are streams of events. The difference between triggers and feeds is:

Creating feeds: feed actions

To create a feed, you first need a feed action. A feed action is an action like any other, but to qualify as a feed action it needs to accept these parameters:

The feed action can take any other parameters you choose; thesy should include any parameters needed to connect to the event source and manage the feed.

Once you have a feed action, create the feed when you create the trigger itself by using the --feed parameter. For example, assume you want to set up a feed for receiving updates to the user's location coming from your mobile app, and have created a feed action named userLocChange in a package in your namespace called userLoc. To create the feed for managing location updates, you could issue the following command in the CLI:

aio rt:trigger:create trigLocUpdate --feed userLoc/userLocChange <optional parameters for the feed action>

This command creates a trigger named trigLocUpdate. Then do something like this:

aio rt:action:invoke userLoc/userLocChange --param lifecycleEvent CREATE --param triggerName trigLocUpdate --param authKey <yourauthKey> --param <optional parameters>

This invokes the feed action userLocChange, which sets up the stream of events from your mobile app aimed at the trigger trigLocUpdate.

You can use the --feed parameter to execute similar functions on feed actions within the aio rt:trigger:delete, aio rt:trigger:update, and aio rt:trigger:get commands.

Feed implementation patterns

You can create a feed according to several different architectural patterns. Three good choices are:

Next steps

Return to the Runtime Reference Documentation Index.

Return to the Guides Index.