Tuesday, December 16, 2014

MQTT on WebSphere MQ

I wanted to use MQTT hosted on WebSphere MQ for my project.  It is an add on. Although it is shipped with the product, it is not installed by default.  So, the first step is to fire up the MQ installer Setup.exe and select "Maintain or upgrade an existing instance", and add the two MQTT components.

After that, you need to run a script to create an MQTT queue manager, and a couple of channels.  One for MQTT traffic, the other for HTTP WebSocket traffic.  They provide a sample file, but it does not include the HTTP WebSocket channel.  So, you'll have to add that.

The Sample file is located here:  C:\Program Files (x86)\IBM\WebSphere MQ\mqxr\samples
and it is called SamplesMQM.bat  or .sh if you're of that ilk.

Copy it, and add these lines at the bottom:
rem Create (and start) a channel
echo DEFINE CHANNEL('WebSocket') CHLTYPE(MQTT) PORT(8000) PROTOCOL(HTTP) MCAUSER('Guest') | runmqsc %QMGR%

While you're in there you can give your QMGR a better name.

Run that batch file, fire up your MQ Explorer, Start your Queue Manager, and you're ready to rock some MQTT traffic.


No comments:

Post a Comment