0

I have a local install of OpenWhisk (vagrant based), and a local install of Cloudant (the free one from the ibmcom/cloudant-developer container).

Both work separately as expected.

Now, using Bluemix, I can use the /whisk.system/cloudant package to use its feeds in my triggers, to for example watch for changes on a specific database.

Locally, this package is missing. I tried to copy the actions and feeds I needed using wsk action get /whisk.system/cloudant/changes (for example) but it seems there's another missing piece of the puzzle as the feed action refers to a cloudanttriggers location I never saw before:

function cloudantHelper(endpoint, verb, name, input) {
    var url = 'http://' + endpoint + '/cloudanttriggers/' + name;
    var promise = new Promise(function(resolve, reject) {
        request({
            method : verb,
            url : url,
            json: input
        }, function(error, response, body) {
            ...
        });
    });

    return promise;
}

Any idea how to implement Cloudant Change feed on a local openwhisk installation?

ralphearle
  • 1,696
  • 13
  • 18
Sebas
  • 21,192
  • 9
  • 55
  • 109

1 Answers1

2

TLDR: You're looking for the CloudantProvider. See https://github.com/openwhisk/openwhisk-package-cloudant

To use the Cloudant feed OpenWhisk needs an additional component to actually listen to changes in Cloudant (the CouchDB _changes feed essentially) and fire the triggers in OpenWhisk. The feed-action you see talks to that service to setup a handler, which listens to _changes in the database you provide. It then fires the trigger specified once it receives a change.

markusthoemmes
  • 3,080
  • 14
  • 23
  • Hi Markus - and thanks. Have you tried this install yourself? The instructions are very scarse and I am pretty confused about what to do to deploy this provider. – Sebas Feb 02 '17 at 13:44
  • I agree the instructions are very scarse. You'll have to first build the image using `gradle` and then deploy it. Unfortunately, there is no ansible playbook in there to achieve that. – markusthoemmes Feb 02 '17 at 13:53
  • Oh, I´m starting to understand. The provider is just a nodejs app constantly polling the db and then calling the ow trigger... – Sebas Feb 02 '17 at 14:12