Archiv pro měsíc: Září 2014

Deploying a report to BIRT on Bluemix

Ok, I have BIRT up and running but there is only example report that’s nice but not so useful.

I haven’t found a simple way how to deploy a rptdesign report definition to the already installed Bluemix/BIRT site. Just the way described below. If you know how to do it easily, please let me know.

I created folder report in the same directory as is birt.war located (please see previous post) and copied my report (say Temperature.rptdesign) into this folder and then packed the report design file into birt.war file and updated the application on the bluemix:

jan@Cake : ~/Downloads/birt-runtime-4_4_0
 $ jar -uvf birt.war report/Temperature.rptdesign
 adding: report/Temperature.rptdesign(in = 68687) (out= 6158)(deflated 91%)
jan@Cake : ~/Downloads/birt-runtime-4_4_0
 $ cf push Birt -p birt.war
 Updating app Birt in org jrydval@post.cz / space dev as jrydval@post.cz...
 OK
 Uploading Birt...
 Uploading from: /Users/jan/Downloads/birt-runtime-4_4_0/toPush/birt.war
 1.6M, 185 files
 OK
 Stopping app Birt in org jrydval@post.cz / space dev as jrydval@post.cz...
 OK
 Starting app Birt in org jrydval@post.cz / space dev as jrydval@post.cz...
 OK
 0 of 1 instances running, 1 starting
...
 1 of 1 instances running
 App started
 Showing health and status for app Birt in org jrydval@post.cz / space dev as jrydval@post.cz...
 OK
 requested state: started
 instances: 1/1
 usage: 512M x 1 instances
 urls: Birt.stage1.mybluemix.net
 state since cpu memory disk
 #0 running 2014-09-24 02:08:49 PM 0.0% 211.9M of 512M 198.5M of 1G

It works:

BIRT Report

But it’s not elegant neither fast. Hopefully I will discover another way how to deploy report definitions to the BIRT engine…

Installing BIRT on Bluemix

Short summary: It cannot be easier to make the visualisation and reporting tool called BIRT working on Bluemix… More precisely to run engine and viewer on Bluemix. You will still need BIRT designer have installed on your PC.

Download BIRT Runtime.

Unpack:

jan@cake : ~/Downloads
 $ unzip birt-runtime-4_4_0-20140611.zip
Archive: birt-runtime-4_4_0-20140611.zip
 creating: birt-runtime-4_4_0/
...

Login into your Bluemix account using web interface and create Birt application using Java Liberty Runtime. But this step is not probably needed.

Login to Bluemix using CF:

$ cf login

and push from the directory where you have just unpacked the BIRT runtime:

jan@cake : ~/Downloads/birt-runtime-4_4_0
 $ cf push Birt -p birt.war
 Updating app Birt in org jrydval@post.cz / space dev as jrydval@post.cz...
 OK
 Uploading Birt...
 Uploading from: /Users/jan/Downloads/birt-runtime-4_4_0/birt.war
 2M, 185 files
 OK
 Stopping app Birt in org jrydval@post.cz / space dev as jrydval@post.cz...
 OK
 Starting app Birt in org jrydval@post.cz / space dev as jrydval@post.cz...
 OK
 0 of 1 instances running, 1 starting
...
 1 of 1 instances running
 App started
 Showing health and status for app Birt in org jrydval@post.cz / space dev as jrydval@post.cz...
 OK

Point your browser to just created application:

BIRT

Done…

IoT Cloud MQTT message to Speech

For demo purposes and to be able to check if the messages are coming from the IoT cloud without looking at the screen all the time I created super simple Node-RED flow that receives messages from IBM’s IoT cloud and log them in the debug tab of the Node-RED UI and in parallel it parses JSON format of the messages to obtain value of the „temp“ property which is then passed to OS X say command.

It can be easily modified to pick another property value just by modifying „JSON and parse“ node.

Screen Shot 2014-09-04 at 13.34.43

 

You can import the flow using „Import -> From Clipboard“ menu item of Node-RED and by pasting the following text and modify your broker details:

[{"id":"7649d216.89b62c","type":"mqtt-broker","broker":"kbrhh.messaging.internetofthings.ibmcloud.com","port":"1883","clientid":"a:kbrhh:viewer2"},{"id":"482fa4c4.b7d05c","type":"debug","name":"Show message","active":true,"console":"false","complete":"true","x":343,"y":62,"z":"948d5198.6b72b","wires":[]},{"id":"a07e3b0c.5f81c8","type":"mqtt in","name":"Receiver","topic":"iot-2/type/sensor-type/id/+/evt/event1/fmt/json","broker":"7649d216.89b62c","x":93,"y":129,"z":"948d5198.6b72b","wires":[["482fa4c4.b7d05c","e9a50fa3.165af"]]},{"id":"e9a50fa3.165af","type":"function","name":"JSONify and parse","func":"msg = JSON.parse(msg.payload)\ntemp = msg.d.temp\ntemp = Math.round(temp * 10)/10;\nreturn {\"payload\": \"Temerature is \" + temp + \" degrees of Celsius\" }","outputs":1,"x":344,"y":199,"z":"948d5198.6b72b","wires":[["4de9ed0c.b21614"]]},{"id":"4de9ed0c.b21614","type":"exec","command":"/usr/bin/say","append":"","useSpawn":"","name":"Say","x":578,"y":258,"z":"948d5198.6b72b","wires":[[],[],[]]}]

You can also change the voice by modifying say command from:

/usr/bin/say

to:

/usr/bin/say -v <voice name>

You can list available voices by entering command

/usr/bin/say -v ?

into terminal.

The flow requires Node-RED installed on a OS X machine.