Experimentation with BlueMix PaaS
You may be wondering why am I blogging about non-SAP PaaS experimentation experience on SCN – SAP Business Trends. The reason will become apparent should you read on.
Firstly I admit as an IBMer I had to undertake a mandatory training on BlueMix which is IBM’s PaaS. I could have left it at that – just doing the training. But BlueMix being new technology with the buzz around it, I decided to take a look into it further. This was partly compelled by the fact I did look into HANA Cloud Platform while doing open.sap.com course last year, so there was something I “knew” about Platform as a Service.
Secondly SAP like other Technology giants are moving into PaaS as the whole IT world embraces Cloud more and more as a reality. The so-called “edge applications” need not be only deployed in HANA Cloud but can exist in other PaaS all the while communicating with SAP Enterprise Applications (read ERP, SCM) which are typically onPremise.
One useful feature of BlueMix (compared to HANA Cloud Platform when I last checked) is a set of different boilerplate runtimes that quickly enables you with creating your app. The runtimes including Java, Node.js, Ruby and something called Node-Red which described itself as “A visual tool for wiring Internet of Things”. Sounded interesting and I could find a simple app “recipe” for it at https://www.ibmdw.net/iot/recipes/node-red which got me up and running quickly.
With the successful deployment of my first BlueMix app, it was time to venture into something more meaningful with the available toolset.
Considering initial Node-Red and IoT recipe using a simulated sensor (incidentally also hosted in BlueMix), I came up with a simple usecase outlined below.
Assume there are Soft Drinks / Cold Dessert Vending Machines in the field that send Temperature, Humidity and Stock data to the App on BlueMix PaaS. This data is processed by Application logic comparing with thresholds for each parameter and trigger appropriate monitoring message say when temperature and humidity is becoming uncomfortable. At the same time the Stock is monitored and if it falls below pre-defined threshold triggers a message that can be used for replenishment order creation. Node-Red provides as standard output messages based on be Twitter or SMS via Twilio.
The replenishment order creation message can technically be sent to SAP via Websphere Message Broker service. How exactly is another topic and beyond my immediate technical capability, but quick research pointed to feasibility.
[UPDATE] Node-Red provides http and Websocket output nodes. In theory using the http output node call to SAP Gateway can be done using OData service thereby triggering replenishment order in backend ECC system.
Building the App
Enter Node-Red to build the App. In the App Node-Red Flow Editor I copied original Node-Red recipe App and started modifying it adding available functions and Twitter output nodes in the palette. As seen below the IoT Input Node at the extreme left is starting point of the App logic where the MAC ID of the sensor is input. Subsequently three logical flows one each for Temperature, Humidity and Stock (used Object Temperature of simulated sensor as a proxy) in a function node, measure the value against threshold (switch node) to determine which of the two conditions (template nodes) is fulfilled. Based on the condition Twitter message is created apart from Debug mode that can used to display the message in Debug tab in the sidepanel as shown below. Once the wiring is done it is a one-click Deploy(ment) to BlueMix cloud and time to test.
Fire it up
To test I needed a sensor and so I fired up a IoT Sensor and started playing with the temperature, humidity and object temperature (proxy for stock level) values using up-down button and swiping between the 3 tiles. Of course the debug tab lighted up with the messages from each of the parameters based on the threshold computation, but it was important to check if the messages were going to outside world.
As I turned attention to my Twitter account a flurry of tweets from the BlueMix app proved it’s working. It was indeed a great feeling seeing the simple auto-generated tweets coming from the quick and dirty App that was indeed up and running successfully.
There can be more complex logic with current data compared with historical Temperature – Humidity – Stock data to have predictive replenishment order creation. Technically these can be built incorporating separate services and in BlueMix there are set of services from both IBM’s own Software Group products as well as 3rd Party with provision If Stock falls below threshold with Temp. & Humidity going higher – trigger replenishment; more complex logic can be built with separate Rule Service and the Historical Device data stored in TimeSeriesDatabase Service. Note: To use the Service links you will need to be logged into BlueMix.
Further it should be also possible to deploy multiple Input Devices (Vending Machines) to the app each with unique Stock, Temp and Humidity thresholds and also scale-out (adding more memory and instances of the app). All these will require actual coding, binding new services to the app, configuring DevOps services (for auto-scaling and app monitoring etc.) but the core App created as shown above may remain as-is and that is the beauty according to me.
I can proudly claim not just trained on PaaS but knowing bit more of how exactly it works and how simple use-case can be developed.
DISCLAIMER: My day-night job is with IBM, but this blog is my personal view and by no means driven by my job requirements. I like to experiment and try out new technology, Bluemix fitted in that space and I wanted to share my experimentation experience.