Skip to main content

Red Hat JBoss A-MQ - A-MQ 在物聯網上的應用,生物感應器Sensor 透過AMQP通訊協定傳送資料

最近越來越多人在談物聯網(Internet of Things,簡寫 IoT ),如果你已經知道物聯網,那請直接跳過,直接往Demo 奔去吧。什麼是物聯網?根據我幫大家Google 過後的定義如下,

"物聯網(The Internet of Things)的概念是在1999年提出的,它的定義:把所有物品通過射頻識別等信息感測設備與互聯網連接起來,實現智能化識別和管理。"

簡單來說,在古早的年代,會聯結上網路的,通常都是一台電腦,可是因為科技的日新月異,網路越來越發達,手持裝置(手機,智慧型眼鏡,血壓計),家電設備(冰箱,電視,烤箱),行車器材(GPS, 行車記錄器)等等,都可以透過不同的雲端技術連接上網。而這些裝置會將大量的資料傳送上網(或者你也可以說,雲端)。不過你想想,當這些龐大的資料同時傳送,而且每一項設備裝置都可能使用不同的通訊協定以及方式,那我們要用什麼樣的東西去接收,才能確保資料穩定接收的成功呢?

這時,一項"古老"的技術,又被人們想起來了。也就是訊息平台 Messaging Platform. 因為它可以大量接受訊息然後同時傳送,或是可以佇列式的讓訊息排隊等待處理的天性。而最近又因應不同的裝置,而發展了屬於不同狀況可以使用的通訊協定。

STOMP (Streaming Text Oriented Messaging Protocol)
完全是純文字的通訊協定,所以不管是什麼語言,或是哪家的訊息Broker 都可以支援。

MQTT (MQ Telemetry Transport)
這算是所有通訊協定裡面最"輕量"的,因為他是專門設計給再遠端的連接方,沒有太好的網路頻寬。因此它擁有 "small code footprint" 。它只能很簡單的把訊息送達Broker, Broker 接收訊息後,如果有需要,會再把訊息導到需要這個訊息的地方。

AMQP (Advanced Message Queuing Protocol)
通訊協定的標準,是功能上比較完整的標準通訊協定。所以大部份的Broker 都會支援它。在程式撰寫部分,也可以透過JMS 與 Apache QPid 這個專案輔助即可。

我們這次的Demo 就是假設人體現在身上帶著不少的Sensor(感應器), 感應器會隨時回傳資料到雲端方便監控。請到Github 去下載程式。

下面的影片有安裝教學,或者是你也可以發摟 Github上面的ReadMe 即可。

PS. 有誰有弄來幫我寫個Windows 的bat 安裝檔?我不想在我電腦上裝Windows, 連VM 我都嫌浪費空間喇~有誰可以幫忙弄一下?

生物感應器Sensor 透過AMQP通訊協定傳送資料 from christina on Vimeo.


Chisoon Chang said…
I found this demo and great demo on youtube. while I tried to conduct the demo on my RHEL 6 with JBoss DS 8.1 installed box. I followed your steps on the page, however, I could not run the ./amq and it return many errors using karaf, felix, commons, fabric....etc by "Unresolved constraint in bundle...". executing 'mvn jetty:run' return "build successfully". I have run some other apache/camel exemples, so I have ./m2/depository.. on my machine. Is anything I missed on my local depository?
Chisoon Chang said…
After googling on line, I found that my java 1.8 was not compatible with jboss-am-q-6.1. I needed to install the jboss-am-q-6.2. Started Ok with 6.2. However, when I started this web project - mvn jetty:run, I got a lot of errors on "ConnectionException... by connection refused" on jmx when I started the monitoring on the web page. What should I correct on the web project on my local station or I missed sth? I am newbie on using such project. Pls advice. Tnx.
Chisoon Chang said…
track further about the source of error, then I found out that with the am-q, there many error logs about "Cannot find class [] for bean with name '' defined in URL [file:etc/activemq.xml]: Cannot create inner bean '' of type [] while setting bean property 'properties'; " therefore the connection was refused. How do I trace such error?
Chisoon Chang said…
Rolled back to default activemq.xml from Jboss-a-mq-6.2 pkg, with, the demo program could run, however, it only generated one message of each monitor (by the terminal console), so sth went run with the in class. Strangely, the 6.2 document on Redhat site, states that the broker config file uses while the package itself uses the "" what exact it should be?
Chisoon Chang said…
Comparing the etc/ of both jboss-a-mq 6.1 vs that 6.2, the (both org.fusesource...cfg files) of 6.1 has been replaced by in 6.2. None the less, the content of both files have little change, except the io.fabric8 one has additional and mq.fabric.server.ts and using server. Is that the cause of error? still with error of "Cannot find class [] for bean with name '" (even copied both to /etc/ of 6.2)

Popular posts from this blog

Fuse Integration Service - Setup JBDS and create first quickstart application

Before we go and start creating our first application, I want to show you how to setup your JBoss Developer Studio, create a small application from the quickstart example and then running it on Fuse Integration Service.

I am using JBoss Developer Studio version 9, you can find it here.
After download the

double-click it, and start installing with default values.

After successful installation, we will need install the plugins for Fuse, on JBoss Central view, select software update, select enable early access.

And select JBoss Fuse Development for the plugin,

Click on install, and we are all set to go!

First thing first, we want to create a Fuse project to deploy on the base of Fuse Integration Service, which is OpenShift. If you have not installed it, please go back to my previous post for instructions. So on your JBDS, right click and start creating the project. Select new, maven project, if you have installed the plugin correctly, you should …

RHTE - Supercharge your integration services

Red Hat Tech Exchange has taken place in Vietnam, Ho Chi Minh city two weeks ago, it is a great event held by Red Hat in Asia Pacific Region. It is open to all Red Hat partners who are interested in learning what Red Hat is doing recently, see what the trend of the open source world, basically it is a great event to share your knowledge and experience, to meet other enthusiastic people.

I am very fortunate to talk in this great event, to talk about the things I have been working on and even discuss it with many. Also got lots of great ideas too. So here are the slide.

My first talk was with Thomas Qvarnström about how to handle large size data in JBoss Fuse and how JBoss Data Grid can help in the situation.

Here is the agenda of the talk, we will be talk about this in the up coming webinar on 24th Sept.

Integration often involves storing, retrieving, and transforming data. Using a traditional database in your integration is likely to becomes a bottleneck that is expensive and hard to …

Red Hat JBoss Fuse/A-MQ - Fuse and A-MQ Version 6.3 GA is released!

Fuse and A-MQ 6.3 GA has just went out. Maybe, you would think this is just only a minor version release why should I care? Hold your thoughts on that! Because they have done a lot of improvements and also added many new features into this release.

Besides various bug fixes and making sure Fuse Fabric is much more stable. There are two major change in this version update:

New Tooling in JBoss Developer Studio (JBDS) 9.1 GA. Newer Apache Camel version – Camel v2.17. I was really impressed by the work put in to make developing Camel application much simpler. First is the installation of tooling itself. Now it has a all-in-one installer so you don't need to worry about which plugins you need to check. See the videos below to see the new "Getting Started" of Fuse 6.3.

And If you notice from the above video, the presentation of camel route in JBDS has also updated. It fixed some of the miss representation of logic and making it easier to read.

Old Camel Route
New Camel Route
On …