Telemetry Daemon - Store and forward messages to WMQ
neekrish 0600011NDE Visits (2286)
Its simple and easy to understand and use this component. Its a 50KB program which run in 150KB or less memory (actual figures vary) making it ideal to run on a small computing devices. Applications can publish messages to this daemon and it can in-turn forward them to WebSphere MQ server or any other MQTT server. There are several other tasks that this can perform which are described in the information center.
In this blog we'll look at building a solution using a set of sensors and WebSphere MQ Telemetry Daemon:
1. First we need a some sensors. We used a evaluation kit for this purpose: JN5139 IEEE802.15.4/JenNet Evaluation Kit for demo purposes. In a development environment its easier to use this kit as it can be reprogrammed to your needs. Each sensor has an onboard temperature, light and humidity sensor. The evaluation kit has a flash programmer that can be used to program these sensors. The code can be written in C language using the Jennic SDK. For demonstration purposes we programmed the sensors to captured the measurements of temperature, light intensity and humidity every 5 seconds and send the data to the controller.
2. The controller is connected to a small computer via the serial cable. On the computer we have 2 programs running:
a. A program that reads data from serial port.
b. The MQ telemetry Daemon for Devices
As you can observe the data input to this small computing device is not from TCP/IP, but rather from serial port. Zigbee standard is used for sensor to controller communication in a Wireless Sensor network. MQTT or MQTT-S can be used on these devices for communication. Using the SDK provided by Jennic, the sensors can be programmed to use MQTT/MQTT-S protocol to communicate with the controller.
3. The program that reads the data from the serial port does a simple task of connecting and exchanging MQTT messages with MQ telemetry Daemon for Devices. Normally WebSphere MQ Server is run at the enterprise level. This could be in a different location like a server room where all the other enterprise software resides. But the telemetry daemon can be installed on a network device in a building. It can route essential information as MQTT messages to the WebSphere MQ server in the enterprise.
Now let's look at using Device Daemon... Its simple to start on a windows machine... It takes just a second to launch...
C:\Program Files\IBM\WebSphere MQ\m
20100913 203000.187 CWNAN9999I MQ Telemetry Daemon for Devices
20100913 203000.187 CWNAN9997I Licensed Materials - Property of IBM
20100913 203000.187 CWNAN9996I Copyright IBM Corp. 2007, 2010 All Rights Reserve
20100913 203000.187 CWNAN9995I US Government Users Restricted Rights - Use, dupl
ication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
20100913 203000.218 CWNAN0053I Version 1.2.0, Jul 19 2010 15:26:51
20100913 203000.218 CWNAN0054I Features included: bridge
20100913 203000.234 CWNAN0014I MQTT protocol starting, listening on port 1883
4. Let's configure the bridge component of telemetry Daemon to send the message to WebSphere MQ. Create a text file with the contents:
Replace the<ipaddress> with the IP address of the system where the WebSphere MQ telemetry is setup on the WebSphere MQ server. The bridge will start once the daemon is started and establish a connection with the server. If the server is not available, it will attempt a reconnect a regular intervals. The configuration file will ensure that the messages published by the MQTT clients to topics starting with "sensor/" are routed to the WebSphere MQ server.
5. On the server side for testing purposes use the WebSphere MQ Explorer and start the sample client program. That is go to "Telemetry" node under <qmg
6. The program that reads the data from the serial port can now publish messages to this telemetry daemon. For testing purposes, let's use a sample provided with the WebSphere MQ telemetry installation to publish messages to telemetry Demon:
C:\Program Files\IBM\WebSphere MQ\m
sensor/1 -m 100
Connected to tcp:
Publishing to topic "sensor/1" qos 2
Press any key to continue . . .
This will publish messages at QOS 2 to the topic "sensor/1" on the Telemetry Daemon. You should be able to see the messages in the on the Server side (i.e WebSphere MQ) in the MQTT Client Utility. As you can see the messages are routed to the WebSphere MQ Server by the telemetry Daemon.
Disclaimer : The postings on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.