The Weight Watcher – a Goal Attainment Scale is an example of an implementation of a Really Simple Rules Service (RSRS). RSRS is a (stateless REST) Decision Server based on JBoss BRMS 6.x that uses a simple facts-in-facts-out (FIFO) pattern and supports CEP use cases. Milo, the Red Dog look-a-like, will show you the way. This lab is another in the OpenShift MiniLabs series.
In this post we make this even easier by hosting our RSRS on OpenShift building on the setup instructions covered in A/B Deployments Made Easy with OpenShift.
$ cd ~/containersascode $ git clone https://github.com/StefanoPicozzi/rsrs.git
To reset your environment to repeat this tutorial do the following:
$ cd ~/containersascode $ ./oc-cluster-wrapper/oc-cluster up containersascode $ oc login -u developer -p developer $ oc delete project weightwatcher
Create OpenShift Project and Application
Pull down and import the the JBoss BRMS image for 6.4 and then create the template as follows:
$ oc login -u developer -p developer $ oc new-project weightwatcher --display-name='WeightWatcher' --description='The WeightWatcher Decision Service Example' $ oc project weightwatcher $ oc import-image decisionserver64 --from=registry.access.redhat.com/jboss-decisionserver-6/decisionserver64-openshift --confirm $ oc create -f rsrs/weightwatcher-template-64.json $ oc new-app decisionserver64-weightwatcher-s2i -l name=weightwatcher --param=KIE_SERVER_PASSWORD=kieserver1! $ oc status
Verify Lab Success
Monitor the build progress from the Console. Once completed the following cURL commands should return a valid response if the solution is operating correctly. You may need to edit the shell script with your weightwatcher URL and KIE_SERVER password. Visit the Environment variables Tab to recover the password set when the template was processed.
$ cd ~/containersascode $ cd rsrs/tools/cURL $ ./post-facts.sh
JBoss Demo Central
The weightwatcher demo is on JBoss Demo Central. Check https://github.com/jbossdemocentral/brms-weightwatcher-realtime-decision-server-demo and https://github.com/jbossdemocentral/jboss-fis-weightwatcher for further worked examples using the application.
To refactor this example for your own Decision Server, just fork the RSRS Git Repo and change the contents to reflect your application. In particular ensure that the kmodule.xml file matches your requirements as at https://github.com/StefanoPicozzi/rsrs/tree/master/weightwatchers/src/main/resources/META-INF .