MQTT & multiple consumers

Hi all,

I’m planning on using an Arduino with a radio shield & ethernet shield (pleasepleaseplease let them be using separate pins!) to receive data from my external weather station and publish via MQTT to multiple consumers. As far as I can tell, MQTT does not support fanout for messages, so I am thinking about having the MQTT plugin on a RabbitMQ broker receive it, then via the shovel plugin, publish it to a fanout queue, where a number of consumers could do things like post the details to Weather Underground, log it into a DB, update a web page etc etc. Any thoughts?

Hi,

What do you mean doesn’t support fanout? do you mean multiple clients? it does. When you publish on a topic multiple clients can subscribe. As many as you will need. There is no practical limit.

I hope I’ve understood correctly. You can collect information from one arduino and distribute that to thousands of consumers with mqtt.

ie: http://www-01.ibm.com/support/knowledgecenter/SSCGGQ_1.2.0/com.ibm.ism.doc/Scenarios/sc00001_.html

It’s just that when I was reading the mqtt doco, there didn’t seem to be a
way of specifying that each message could be seen by multiple consumers, in
contrast to the RabbitMQ doco, which makes a point of specifying how you
set up different queue types.

It’s probably easiest just to try and see.

There’s some command line clients that are pretty easy to use that you can run without having to even write any software.

http://mosquitto.org/2012/03/quick-start-guide-for-mqtt-with-pachube/

A client publishes items for specific topics.
A client subscribes to any topic(s) of interest and is notified when a new value is published.
There can be as many clients as you need (naturally there will be some resource limits).

I used mosquitto and can run

mosquitto_sub -i subber -h mqtt-server -v -t 'stats/temperature/esp-07'

from multiple consoles (using different -i ID in each).

Now publishing, e.g.

mosquitto_pub -i pubber -h mqtt-server -r -t 'stats/temperature/esp-07' -m '17.5625'

will deliver the message to all the consoles.

Whichever package you use it probably provides similar tools. It really is that simple.

The whole point of MQTT is to have many clients following the same topic, or else a simple point to point protocol would do.

cheers

Perhaps I should rephrase things - does anyone have a working example of a
mqtt publisher with multiple consumers, where each consumer gets each
message? Other MQ packages require you to set up that configuration
explicitly.

Looking a bit further at some of the examples, it appears as if it does do what I want. Nice.