Tag Archives: mule

Mule MQTT Connector v0.2 Final Released!

It’s with great pleasure that I introduce Mule MQTT Connector v0.2!!!  Not a lot of changes since v0.1, except for some nice-to-have features that I felt were necessary.  

In this release, there are two major changes that should make this connector a bit more usable by many in the community.  These two changes were:

  • <mqtt:subscribe> now contains a “filter” attribute.  Instead of setting “topicName”, one can simply set the topic filter they’d like to use.  When messages are received that match the filter, Mule simply sets all the appropriate OUTBOUND headers, one being the “topic.name”, so you can do routing in Mule based on where it was received.  An example of a topic filter is “sample/#”, which matches “sample/foo” or “sample/bar”, etc.  
  • <mqtt:publish> no longer only takes a java.lang.String payload-only.  You can now simply omit setting the “message” attribute of the publish call, and whatever the current MuleMessage payload is will be converted into a byte[].  Warning:  “message” takes precedence over the MuleMessage payload if set.

I also did some code cleanup, documentation cleanup, etc.  I anticipate new graphics in the near future (for Mule Studio) and submission to MuleForge very soon.  Follow my blog, as I’ll be posting a HOWTO for installation and use of the connector soon as well. 

Thanks for the outpouring of interest and support for this!! 

Code:  https://github.com/dmiller44/mule-module-mqtt  (tagged as “v0.2-final”)

Documentation:  http://dmiller44.github.com/mule-module-mqtt

Advertisements

Fixes Released, v0.1 FINAL is out!

Tonight I released the final version 0.1 build.  I added a couple nice-to-have’s to this build, including:

  • Full support for the LWT portion of MQTT protocol.  (this is all configurable on the <mqtt:config /> tag). 
  • Change to get rid of the MuleMqttMessage object, and instead return the byte[] payload of a message, with relative information stored in the INBOUND property scope.  I also modified the publish method to appropriately set the OUTBOUND scope accordingly.
  • Fixes to a couple bugs, mainly with Mule application reloading, so that clients appropriately disconnect/reconnect with the MQTT broker. 

You’ll notice I stripped out my functional test cases, and this was due to improper coding of them on my part.  I’m going to re-introduce proper test cases in my upcoming version, 0.2, hopefully.  

Enjoy!

https://github.com/dmiller44/mule-module-mqtt


MQTT and Mule ESB – Connector v0.1 Release

As a man fascinated by home automation, I constantly am reading up on the latest technical news when it comes to data integration in my home.  MQTT recently was thrown into my radar, and I began researching it to see if it’s capabilities would work in my blooming home automation project.  The scenario I had was simple:  I have two young children, with two new rooms recently added to my home to accommodate them.  Does our current heating/cooling system keep their rooms at an ideal temperature for them to rest comfortably?  Or will I horrifically overheat or chill my children due to improper balancing of my HVAC system?  I created two small, wireless, Arduino-based XBEE sensors that could report to me the room’s humidity and temperature stats (amongst other things), but needed a system for these two sensors to report to.  Enter MQTT and the Mosquitto broker.

MQTT was a solid fit for what I was looking to accomplish.  Having experienced RabbitMQ/AMQP over the last three years, I’m a fan of topic-based pub/sub systems.  However, AMQP is a bit overkill for sending sensory data so simple as room temperature, and MQTT is perfect for taking over the job.  The issue I had was with integration into my other systems:  I use Mule ESB as my SOA hub for all my data storage and reporting systems in the house.  So, I was saddened to see that, while supporting a plethora of other protocols, MQTT was not yet supported natively or via MuleForge.  So I decided to change that, not just for myself, but for others looking to do similar projects as me.

Without further ado, I introduce the MQTT Mule Module v0.1.  Let me start by putting up the normal disclaimer:  Use this connector at your OWN RISK!  While I will do my best to keep it relevant and in solid working order, I’m doing this all on my personal time, which can be lacking when it comes to hobbies.  Second disclaimer:  I’m not yet well-versed in MQTT, or in the creation process of Mule Modules/Connectors.  So, these first couple releases are a learning experience for me, and I apologize if I have veered from good coding convention, or if a feature or two have been overlooked.  I’m simply trying to get this connector in the wild so it can begin getting pressure tested by folks like yourself.

So what does v0.1 have?  Pretty simply put, it has everything you need to subscribe and publish to a MQTTv3 broker.  I’ve tested against Mosquitto servers only, so your mileage may vary.  Currently, you can only subscribe to a single topic (no topic filters in this initial release).  Also, you can only publish java.lang.String messages to the broker.  Retention policies haven’t been exposed to you yet (I’m working on that) and LWT messages are not available.

Sounds pretty thin, doesn’t it?  Great news:  v0.2 is already in the works.  It will expose the abilities that I had left out in the interest of time (such as retain settings exposure and LWT), and will also have a couple added features like payload transformations and population of inbound scope properties during subscribe.  It will also contain any bugs found in the initial release, which I expect to be a few.

Documentation currently is being kept here:
http://dmiller44.github.com/mule-module-mqtt/

Source code is currently hosted here:
https://github.com/dmiller44/mule-module-mqtt

Issues can be tracked here:
https://github.com/dmiller44/mule-module-mqtt/issues?state=open

The module has been tested using the Mule ESB 3.3.0 Community Edition, but has been targeted to work *hopefully* on version 3.2.2.  I will continue to test this connector against the Mule instances I have running and update the documentation as I discover issues.

I encourage all of you to test this out and give me constructive feedback.  I can’t stress enough how excited I am to be releasing this, but how nerve racking it feels to release something without having a lot of exposure to the coding practices and standards of writing such a plugin.  It’s my hope that over the next many months, this module will stabilize and become a reliable connector for folks to use in their personal and professional endeavors.

Thanks for your interest!  Please leave comments below or at the Github site.

– Dan