Pages

Monday, July 16, 2012

Getting Started with MQTT

This is the first in what I hope turns out to be a series of posts about one geek's journey into MQTT and let me tell you it was big doings tonight !!

I was successfully able to publish and subscribe a MQTT message for the first time ! It was not as tough as I thought it would be but only because of the IBM redbook Building Smarter Planet Solutions with MQTT and IBM WebSphere MQ Telemetry The first step was to launch a terminal client from my Ubuntu box that has mosquitto installed.

I then typed in the command to publish  "mosquitto_pub -t samples/topic01 -l"
 (well I copied the exact description of the command from the redbook which is mosquittopub and I got an error No command 'mosquittosub' found, did you mean: mosquitto_pub. I am very new to Linux and do not know why the redbook said one thing and another work, so I will have to add this to the research list down the road.  )

I then opened a second Terminal and entered the command for a subscription
mosquitto_sub -t samples/topic01
I then entered a message in the publish screen and pressed enter.
and low and behold it appeared on the second screen ! Page 46 of the redbook says that "The examples assumes that the client and the server are on the same machine" I will be interested to see what makes this assumption work but will have to save that for another night. 

No comments:

Post a Comment