Scenario: User wants to create a trigger trigger1
for MessageHub service instance instance1
, using Credentials Credential-1
and use rule rule1
to invoke action action1
with messages from topic topic1
.
- Developer creates a MessageHub service
instance1
- Developer creates topic
topic1
in MessageHub serviceinstance1
- Developer creates Credential key
Credential-1
for MessageHubinstance1
- Developer creates trigger
trigger1
on OpenWhisk, the trigger stores the annotationfeed
with the feedAction name from system package or binded package.(/whisk.system/messagingWeb/messageHubFeed
). - Developer invokes action feedAction to create trigger feed passing input parameters (lifeCycle:
CREATE
,trigger1
, Credentials1, Options:topic1
) - The feedAction invokes feedWebAction forwarding input parameter.
- The feedWebAction inserts trigger feed doc into the DB for worker group 0 (feedWebAction protects DB credentials)
- DB insertion notifies workers group 0 via Cloudant/CouchDB changes API, workers listen on DB view with a filter for their group
worker0
and gets the DB doc. - Kafka Consumer is created on each worker in a consumer group and starts polling for messages on
topic1
frominstance1
usingCredentials-1
. - Developer creates
rule1
indicating that whentrigger1
fires invokeaction1
. - Event source produces messages on
topic1
. - Both consumers will batch the messages from
topic1
and firetrigger1
.- The fire is done with an http request containing the batch of messages in the body.
- Consumer will not poll for more messages and will not commit batch of messages until the http request gets a response from OpenWhisk trigger endpoint.
- Consumers in the same consumer group get assigned a set of partitions, each consumer on each worker host will get a unique set of messages avoiding duplicate messages being included in trigger fires.
- OpenWhisk will process the trigger fire for
trigger1
and finds therule1
and invokesaction1
with messages from topictopic1
.
Scenario: User wants to update trigger trigger1
to change from topic topic1
to topic topic2
.
- Developer creates topic
topic2
in MessageHub serviceinstance1
. - Developer gets the annotation
feed
from triggertrigger1
. - Developer invokes feedAction to update trigger feed passing input parameters (lifeCycle:
UPDATE
,trigger1
, Options:topic2
). - The feedAction invokes feedWebAction forwarding input parameter.
- The feedWebAction inserts trigger feed doc into the DB for worker group 0 (feedWebAction protects DB credentials).
- DB insertion notifies workers group 0 via Cloudant/CouchDB changes API, workers listen on DB view with a filter for their group
worker0
and gets the DB doc. - Kafka Consumer is re-created on each worker in a consumer group and starts polling for messages on
topic2
frominstance1
usingCredentials-1
. - Event source produces messages on
topic2
. - Both consumers will now handle
topic2
instead oftopic1
. - OpenWhisk will process the trigger fire for
trigger1
, finds the rulerule1
and invokesaction1
with messages from topictopic2
.
Scenario: User wants to read the configuration and status for trigger trigger1
.
- Developer gets the annotation
feed
from triggertrigger1
. - Developer invokes feedAction to read the trigger feed passing input parameters (lifeCycle:
READ
,trigger1
). - The feedAction invokes feedWebAction forwarding input parameter.
- The feedWebAction gets the trigger feed doc from the DB (feedWebAction protects DB credentials).
- The DB returns the trigger feed doc for
trigger1
. - The feedWebAction returns a response to feedAction.
- The feedAction returns response (config, status) to Developer.
Scenario: User wants to delete trigger trigger1
.
- Developer deletes rule
rule1
- Developer gets the annotation
feed
from triggertrigger1
. - Developer invokes feedAction to delete the trigger feed passing input parameters (lifeCycle:
DELETE
,trigger1
). - The feedAction invokes feedWebAction forwarding input parameter.
- The feedWebAction updates the trigger feed doc into the DB with a field
delete:true
(feedWebAction protects DB credentials). - DB update notifies workers group 0 via Cloudant/CouchDB changes API, workers listen on DB view with a filter for their group
worker0
and gets the DB doc. The Kafka consumers fortrigger1/topic2
get destroyed. - The feedWebAction deletes the trigger feed doc from the DB.
- The Developer deletes trigger
trigger1