How to create sub topic with MQTT

514 views
Skip to first unread message

IBhadelia

unread,
Feb 15, 2017, 1:36:17 AM2/15/17
to rabbitmq-users
Hello Experts

I have requirement to support MQTT protocol with RabbitMQ. We did our PIC using AMQP but now we have to support MQTT, what we did is single topic for each company and routing key as device group which binding to queue and for sending data back to device we create individual Queue under their company. This works great with AMQP, but I dont see MQTT is supporting as it works with topic.

So need suggestion, how to achieve routing based filtering with MQTT, is there any feature called sub topics? As I came across this link https://www.rabbitmq.com/blog/2010/09/14/very-fast-and-scalable-topic-routing-part-1/ I assume this is what I can do but is it feasible with MQTT protocol?

By the way, I am building .NET application and using M2Mqtt .net client

Thanks
Imran

Michael Klishin

unread,
Feb 15, 2017, 3:24:55 AM2/15/17
to rabbitm...@googlegroups.com
2nd link in Google for "MQTT topic structure": http://tinkerman.cat/mqtt-topic-naming-convention/.

MQTT topics are translated into AMQP 0-9-1 topics as documented on http://www.rabbitmq.com/mqtt.html.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

IBhadelia

unread,
Feb 15, 2017, 6:41:06 AM2/15/17
to rabbitmq-users
Thanks for link I already have that one while doing google... But my concern is, how can I create /home/llivingroom/bulb1/status structure? what I assume is home will be topic in which livingroom again new topic, is it? if yes then how can I create such topic hierarchy?

thanks
Imran

On Wednesday, 15 February 2017 13:54:55 UTC+5:30, Michael Klishin wrote:
2nd link in Google for "MQTT topic structure": http://tinkerman.cat/mqtt-topic-naming-convention/.

MQTT topics are translated into AMQP 0-9-1 topics as documented on http://www.rabbitmq.com/mqtt.html.
On Wed, Feb 15, 2017 at 9:36 AM, IBhadelia <imran....@gmail.com> wrote:
Hello Experts

I have requirement to support MQTT protocol with RabbitMQ. We did our PIC using AMQP but now we have to support MQTT, what we did is single topic for each company and routing key as device group which binding to queue and for sending data back to device we create individual Queue under their company. This works great with AMQP, but I dont see MQTT is supporting as it works with topic.

So need suggestion, how to achieve routing based filtering with MQTT, is there any feature called sub topics? As I came across this link https://www.rabbitmq.com/blog/2010/09/14/very-fast-and-scalable-topic-routing-part-1/ I assume this is what I can do but is it feasible with MQTT protocol?

By the way, I am building .NET application and using M2Mqtt .net client

Thanks
Imran

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Feb 15, 2017, 6:51:06 AM2/15/17
to rabbitm...@googlegroups.com
Topics are specified by clients as strings or similar data structures. Compose them however you like.

Beyond segment-based routing they have no meaning.
It's a matter of your applications agreeing on a topic structure, nothing else.

IBhadelia

unread,
Feb 16, 2017, 12:57:28 AM2/16/17
to rabbitmq-users
Got it. Thanks for helping me understanding this structure.

I am done with POC as you mentioned and its working like charm :)

Now new question :)... Its using default exchange that is amq.topic and put messages there, i also seen that unless and until someone listen to that topic it doesnt create binding and queue. I assume its not going to lost :) but question is, isnt it have performance issue with single exchange?

Thanks
Imran

Michael Klishin

unread,
Feb 16, 2017, 6:03:28 AM2/16/17
to rabbitm...@googlegroups.com, IBhadelia
If there are no MQTT consumers or a bound queue from previous consumers or
set up e.g. via AMQP 0-9-1, messages won't get routed anywhere. This is where MQTT
QoS preference can make a difference (and not something really specific to RabbitMQ).

Exchanges are routing tables, every node has a copy, every channel can do the routing.
It's not at all similar to using a single queue (which has limited throughput).

On 16 February 2017 at 08:57:33, IBhadelia (imran....@gmail.com) wrote:
> Got it. Thanks for helping me understanding this structure.
>
> I am done with POC as you mentioned and its working like charm :)
>
> Now new question :)... Its using default exchange that is amq.topic and put
> messages there, i also seen that unless and until someone listen to that
> topic it doesnt create binding and queue. I assume its not going to lost :)
> but question is, isnt it have performance issue with single exchange?
>
> Thanks
> Imran
>
> On Wednesday, 15 February 2017 17:21:06 UTC+5:30, Michael Klishin wrote:
> >
> > Topics are specified by clients as strings or similar data structures.
> > Compose them however you like.
> >
> > Beyond segment-based routing they have no meaning.
> > It's a matter of your applications agreeing on a topic structure, nothing
> > else.
> >
> > On 15 Feb 2017, at 14:41, IBhadelia >
> To post to this group, send an email to rabbitm...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages