This feed action is responsible for creating the Infinispan cach listener and associating it with a Trigger
-
Deploy Infinispan on OpenShift
-
Deploy OpenWhisk on Minishift
Important
|
oc adm policy add-role-to-user admin developer -n openwhisk |
wsk -i package create --shared yes redhatdevelopers (1)
-
this could be anything, if you change it please update pom.xml
openwhisk.package
property
mvn clean package (1) wsk -i action update -a feed true redhatdevelopers/infinispan-feed \ target/infinispan-feed-action.jar --main org.workspace7.openwhisk.InfinispanFeedAction
-
if you have WSK CLI installed, post package
You will need to deploy the Infinispan Feed Provider before creating the trigger. Refer to the README on the deployment.
wsk -i trigger create cacheEntryTrigger --feed redhatdevelopers/infinispan-feed \ -p hotrod_server_host infinispan-app-hotrod \ (1) -p hotrod_port 11222 \ (2) -p cache_name default (3) wsk action create cacheEntryTriggerAction src/handler.js (4) wsk rule create cacheEntryRule cacheEntryTrigger cacheEntryTriggerAction (5)
-
If you deployed Infinispan using method referenced in Pre-requisite, then the default hostname is infinispan-app-hotrod and by default this is accessible only from within OpenShift cluster
-
The HotRod Client Port to connect to
-
The Cache Name for which the listener to be registered
-
Create a dummy action just to see what parameters are sent via the event source
-
Associate the Trigger with Action via a rule
Tip
|
|
Infinispan Feed Provider provides
a REST path called /data/add/{key}
which can be used to add dummy entry to see
the cache entry event triggering the cacheEntryTriggerAction
curl -X GET --data "hello world" $(minishift openshift service infinispan-feed-provider -n myproject --url)/data/add/testKey2018 (1) wsk activation list -limit 1 cacheEntryTriggerAction (2) wsk activation result <activation-id> (3)
-
Add a test cache entry, this by default adds to
default
cache -
Check if the cacheEntryTriggerAction action is triggered as a result of cache entry addition
-
Check what payload the cacheEntryTriggerAction has recevied