Slide 1

Slide 1 text

APACHE OPENWHISK - PLUGGABLE EVENT PROVIDERS James Thomas, OpenWhisk Committer, Serverless Dev Adv Lead @ IBM ☁

Slide 2

Slide 2 text

APACHE OPENWHISK TRIGGER FEED PROVIDERS ➤API Gateway ➤Apache Kafka ➤Apache CouchDB ➤Cron Alarm ➤Github ➤…

Slide 3

Slide 3 text

APACHE OPENWHISK TRIGGER FEED PROVIDERS Why don’t we have more? Lots of community contributions for runtimes Not so much for feed providers…

Slide 4

Slide 4 text

APACHE OPENWHISK TRIGGER FEED PROVIDERS Why don’t we have more? Trigger feeds are not that simple to implement. Documentation is not great.

Slide 5

Slide 5 text

APACHE OPENWHISK TRIGGER FEED PROVIDERS Was asked internally to produce an S3 compatible feed provider. Use polling to check bucket file etags for file changes.

Slide 6

Slide 6 text

HOW OPENWHISK TRIGGER FEEDS WORK wsk trigger create periodic \ --feed /whisk.system/alarms/alarm \ --param cron "*/2 * * * *" \ --param trigger_payload “{…}” \ --param startDate "2019-01-01T00:00:00.000Z" \ --param stopDate "2019-01-31T23:59:00.000Z" feed parameter refers to a normal action action invoked with the trigger details by cli

Slide 7

Slide 7 text

TRIGGER FEED API custom feed provider is supposed to manage listening to event source and firing triggers on events

Slide 8

Slide 8 text

EXISTING TRIGGER FEED PROVIDERS ARCHITECTURE - ADDING TRIGGER Feed Action Web Action Trigger Database Event Provider Event Source User Trigger wsk CLI - User creates trigger with feed with wsk CLI tool - CLI calls feed action with trigger & auth details - Feed action calls web action (?) - Web action writes to Trigger management database

Slide 9

Slide 9 text

EXISTING TRIGGER FEED PROVIDERS ARCHITECTURE - EVENT PROVIDER Feed Action Web Action Trigger Database Event Provider Event Source User Trigger wsk CLI - Event provider follows DB updates - Uses trigger details to start listening to external event source - Web action writes to Trigger management database

Slide 10

Slide 10 text

EXISTING TRIGGER FEED PROVIDERS ARCHITECTURE - EVENTS OCCUR Feed Action Web Action Trigger Database Event Provider Event Source User Trigger wsk CLI - Provider fires trigger with event details when they occur.

Slide 11

Slide 11 text

APACHE OPENWHISK TRIGGER FEED PROVIDERS Looking at the different feed providers, most of the code is not specific to the event source. 90% of code base = generic trigger management

Slide 12

Slide 12 text

“Can we build a generic event provider with a plugin architecture? - Easier to contribute event sources - Easier to maintain feed provider

Slide 13

Slide 13 text

GENERIC TRIGGER FEED PROVIDERS ARCHITECTURE Feed Action Web Action Trigger Database Generic Event Provider Custom Event Source - Plugin handles custom event source integration - Trigger management handled by generic provider Custom Event Source Plugin

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

RESULT = event provider in ~300 lines of JS

Slide 21

Slide 21 text

Is this interesting to others? Possible next steps… - Open-source code on Github? - Write more event provider plugins? - Donate to Apache (eventually)?