Home United States USA — software IoT Using Apache Camel and JBoss A-MQ

IoT Using Apache Camel and JBoss A-MQ

269
0
SHARE

Here’s a simple example of a smart city project that measures air pollution using a combo of sensors, JBoss A-MQ, MQTT, and Kibana.
Let’s be friends:
Comment ( 0)
Join the DZone community and get the full member experience.
This post proposes using IoT to address the problem of degrading air quality in cities.
The idea is that a sensor will measure the air pollution levels and transmit that data. The information will then be shared with the users of the system.
The example demonstrates how to get value from IoT data by using Apache Camel, JBoss A-MQ, and Elasticsearch .
The basic architecture of this demo is basically as follows:
There are three common protocols when it comes to IoT messaging — MQTT, AMQP, and STOMP. In this example, all sensor devices use MQTT (which is supported by JBoss A-MQ) to interact and connect.
Why MQTT? It is an OASIS standard, adopted by various vendor and companies. It is an extremely lightweight transport and is excellent for low-power devices and associated platforms. It supports a publish and subscribe mechanism that we will make use of.
All IoT data collected by the sensors are sent and aggregated reliably in JBoss A-MQ and processed by Apache Camel. After that, data is stocked in Elasticsearch for real-time notifications.
You have to add the MQTT transport connector to JBoss A-MQ. To do that, you have to add the following line in your Broker.xml:
Then install Camel Route. This route uses built-in components in JBoss Fuse to pull in the message from the broker. With the built-in component, it will save lots of code implementation time.
As you can see from the Camel Route example, after we retrieve messages from the topic IoT, we will process it and store it in Elasticsearch, which will be picked up by Kibana and displayed in a dashboard.
At the Elasticsearch level, you have to create a new index with the following mapping:
At this moment, all data is available in Elasticsearch and we have just to explore and visualize it via Kibana. For that, you have to create some visualizations that will be included in your dashboards.
Below is an example of a custom Dashboard:
I hope that you find this post useful, and good luck with your projects!
Free DZone Refcard
Comment ( 0)
Opinions expressed by DZone contributors are their own.

Continue reading...