Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT v5.0 support #2554

Closed
wrsrap opened this issue May 16, 2019 · 35 comments · Fixed by #7263
Closed

MQTT v5.0 support #2554

wrsrap opened this issue May 16, 2019 · 35 comments · Fixed by #7263
Assignees
Milestone

Comments

@wrsrap
Copy link

wrsrap commented May 16, 2019

Are there plans to support MQTT v5.0 in this plugin?Thank you.

@michaelklishin michaelklishin changed the title About MQTTv5.0 MQTT v5.0 support May 16, 2019
@michaelklishin
Copy link
Member

There are plans but we offer no ETA promises. The earliest release it can happen in will be 3.9.0.

@tsturzl
Copy link

tsturzl commented Sep 18, 2019

I'm willing to contribute here as I'm coming up on needing the ability to use the Shared Subscription feature included in v5.0. If there's any general guidance you can give to how I could begin an implementation of this feature I'd be happy to make a PR hopeful in the near future.

@ajayb0507
Copy link

Hi, Is this still on schedule ? Thanks.

@michaelklishin
Copy link
Member

michaelklishin commented Apr 22, 2020

It is still scheduled to be implemented but we offer no ETA as there are too many higher priority items on our roadmap. This is open source software so those who need MQTT v5.0 support can contribute it, or at the very list document all the differences from 3.1.1 which would greatly help with assessing the amount of work it would take.

@An0nymous0
Copy link

look forward to

@lukebakken lukebakken transferred this issue from rabbitmq/rabbitmq-mqtt Nov 16, 2020
@petersilva
Copy link

petersilva commented Jan 17, 2021

in case it is helpful, the feature that most interests me is shared queues. with AMQP 0.9 you just have multiple processes connect to the same queue to do sharing. with MQTTv3, only one consumer at a time. there is a concept of shared queues that promises to address that. Very interested in that feature in particular.

I think the idea is $share/group_name/topic_tree ...

where group_name would seem to map to a queue name (in the sense that it accomplishes the same level of grouping a multiple subscribers using a common queue) in AMQP.

@michaelklishin
Copy link
Member

michaelklishin commented Jan 18, 2021

Shared queues with repeatable reads will be provided by streams in 3.9, not via MQTT but any future such features likely will lean on them.

@petersilva
Copy link

No need for new features on the rabbit side. The existing sharing of queues (has been there last ten years or so) is fine... I just have multiple subscribers connect to the same queue with a prefetch, and I can have 40 subscribers share a high speed queue (that does not build up.) I don't see a way to do that with MQTTv3. I think v5 might help.

@adiroiban
Copy link

For the reference, a document with differences between v3.1.1 and v5 - https://github.com/mqtt/mqtt.org/wiki/Differences-between-3.1.1-and-5.0

@briggySmalls
Copy link

For me a big appeal of v5.0 is the "Reason code on all ACKs" (in same link as @adiroiban).

If a client attempts to publish/subscribe to a topic that an ACL denies them, the MQTT 3.x specs silently accept the operation. MQTT 5.x introduces the return code for "Not authorised".

@petersilva
Copy link

petersilva commented Mar 26, 2021

What would be really cool for v5 support:
-- map each topic exchange to the root of mqtt topic tree.
-- prepend with $share/queue_name/exchange/ .... rest of the topics.

If the exchange is not a topic exchange, it does not participate in the mapping.
That way, people can connect to the same broker with either protocol and access the entire broker.

example:

I want five processes to use the same queue "worker" bind to "canada.public" topic on the "xwarnings" exchange in AMQP sharing the messages among the five. That should be equivalent to subscribing to "$share/worker/xwarnings/canada/public" in MQTT plugin.

@petersilva
Copy link

fwiw... I use this mapping here:
https://github.com/MetPX/sarracenia/tree/v03_wip/sarracenia/moth

There are MQTT and AMQP sub-classes of the "Messages Organized by Topic Header" I use mosquitto for the MQTT stuff, because the rabbitmq isn't rich enough currently.

@BastianMattes
Copy link

Any updates on when MQTT 5 will be supported? Do you have a roadmap somewhere on planned features?

@lukebakken
Copy link
Collaborator

Anyone asking about MQTT 5.0 support should read @michaelklishin 's comment (link):

It is still scheduled to be implemented but we offer no ETA as there are too many higher priority items on our roadmap. This is open source software so those who need MQTT v5.0 support can contribute it, or at the very least document all the differences from 3.1.1 which would greatly help with assessing the amount of work it would take.

Note that there is useful work that people could do that would speed the process up yet we have not yet received assistance from the community.

@BastianMattes
Copy link

This reads like this project is understaffed. That's important to know if you need to decide between different MQTT brokers. Thanks for the honest answer, @lukebakken !

@yaronp68
Copy link

@BastianMattes MQTT 5 support is not a high priority right now. However, we do consider bridging MQTT brokers withRabbitMQ so you will have a solution that has an MQTT layer and Streams / AMQP queues layer facing the IoT processing applications. Would a connector like this (with orchestration) be something you would like to try?

@BastianMattes
Copy link

@yaronp68 Thank you for asking, but we don't plan to have any AMQP clients, so if we were to use another MQTT broker, there would be no need for us to have a bridge to RabbitMQ since we wouldn't need RabbitMQ anymore at all.

@tsturzl
Copy link

tsturzl commented Nov 18, 2021

@BastianMattes You're not paying for a support license, and there's not enough interest in this feature. AFAIK you can pay for commercial support for RabbitMQ: https://tanzu.vmware.com/rabbitmq

The idea that RabbitMQ is run by a skeleton crew is kind of silly. The reality is you're either banking on the free time of contributors to implement a niche feature, or you're hoping a company will implement it, but you're not paying that company. Such is the nature of opensource. If this had more interest it might get done faster, but as far as message queues that also support MQTT they basically all only support v3.1.1. You can go pay for HiveMQ or use the community version of VerneMQ if you're really really sure MQTTv5 actually provides all the features you need.

@BastianMattes
Copy link

Thanks for the suggestion, @tsturzl , we will consider this in the future.

@couling
Copy link

couling commented Sep 1, 2022

For those of us not familiar with the project, is there a comment on why this issue was closed besides being open for a long time with little progress?

Has it now been deemed that rabbitmq will never support MQTT5?

@lukebakken
Copy link
Collaborator

is there a comment on why this issue was closed besides being open for a long time with little progress?

This issue is not closed. I'm not sure why you think that.

Has it now been deemed that rabbitmq will never support MQTT5?

No. RabbitMQ will support MQTT 5 at some point in the future. Hopefully it will ship with version 4.0

@rabbitmq rabbitmq locked and limited conversation to collaborators Sep 1, 2022
@lukebakken lukebakken added this to the 4.0.0 milestone Sep 1, 2022
@lukebakken lukebakken self-assigned this Sep 1, 2022
@michaelklishin
Copy link
Member

Before RabbitMQ supports MQTTv5 we decied to significantly optimize the MQTTv3.1 implementation we have. Chances are, MQTTv5 can ship around the 3.12 time frame, and hopefully it will be in the open source edition (the core team cannot guarantee that).

@lukebakken lukebakken self-assigned this Oct 24, 2022
@ansd ansd mentioned this issue Jan 17, 2023
@ansd ansd linked a pull request Feb 12, 2023 that will close this issue
23 tasks
@ansd ansd modified the milestones: 4.0.0, 3.13.0 Feb 12, 2023
@ansd ansd mentioned this issue Jun 13, 2023
23 tasks
@lukebakken
Copy link
Collaborator

lukebakken commented Jun 13, 2023

@t03apt @feixuenihaoma @liamdiprose @yyyyeeeeesss @ramlongcat @hiepthai @gogangipark @andrew-kratik @An0nymous0 @lazystone @msallin @siaron @lddhappy @monkalways @niburhsoj @alaendle @fungiboletus @lhoste-bell @zaksnet @jonaskello @phaseOne @maxlein @BastianMattes @paulojoao @nouzun @damikun @Daschi1 @couling @tsturzl @petersilva @briggySmalls @adiroiban @An0nymous0 @ajayb0507

Hello! Everyone who has asked "When will RabbitMQ support MQTT 5" or thumbed-up this issue, PLEASE take the time to test this new feature. It's the least you can do! The following docker image contains the code in PR #7263 -

pivotalrabbitmq/rabbitmq:main-otp-max-bazel

@rabbitmq rabbitmq unlocked this conversation Jun 13, 2023
@alaendle
Copy link

@lukebakken - Thanks for pinging us; I'm currently testing MQTT5 support. Looks all good to me - connect with userproperties; publish with userproperties; qos 0/1 - maybe one small improvement idea: is it possible to somehow show the connect userproperties in the management UI? I would have expected to see them below "Client properties"
grafik

ansd added a commit that referenced this issue Jun 26, 2023
and CLI as requested in
#2554 (comment)

"User Properties on the CONNECT packet can be used to send connection related properties from the Client to the Server.
The meaning of these properties is not defined by this specification."
[v5 3.1.2.11.8]

It makes sense to display the User Property of the CONNECT packet in the
Management UI in the connection's Client Properties.
@ansd
Copy link
Member

ansd commented Jun 26, 2023

Thank you @alaendle for testing MQTT 5 and your feedback.
I like your idea and implemented it in #8681.

ansd added a commit that referenced this issue Jun 26, 2023
and CLI as requested in
#2554 (comment)

"User Properties on the CONNECT packet can be used to send connection related properties from the Client to the Server.
The meaning of these properties is not defined by this specification."
[v5 3.1.2.11.8]

It makes sense to display the User Property of the CONNECT packet in the
Management UI in the connection's Client Properties.
@couling
Copy link

couling commented Jun 26, 2023

@lukebakken Is the shovel plugin not working in this image? Our setup for MQTT has an edge/extranet broker with shovel to/from a core broker. For me to stress test this I'd need that working, but I'm just getting Shovel 'Dispatch Instructions' could not connect to source when I try. Note I've basically dropped this in place of an existing instance with the same config, so this shouldn't be subject to firewall issues etc.

@ansd
Copy link
Member

ansd commented Jun 27, 2023

When testing MQTT 5, please start using docker image pivotalrabbitmq/rabbitmq:main-otp-max-bazel since PR #7263 was merged into main branch. (I updated Luke's comment above).

@couling the shovel plugin is supposed to work in this image. The plugin is disabled by default, but you can enable it. The error message you pasted does not provide useful information: I added the error reason to the log in #8686
If you think that the MQTT 5 PR broke the shovel plugin (I would be surprised if it did), please provide us reproducible steps including all config files (ideally create a separate GitHub repo with reproduction steps).

@michaelklishin
Copy link
Member

michaelklishin commented Jun 27, 2023

@lukebakken Is the shovel plugin not working in this image? Our setup for MQTT has an edge/extranet broker with shovel to/from a core broker. For me to stress test this I'd need that working, but I'm just getting Shovel 'Dispatch Instructions' could not connect to source when I try. Note I've basically dropped this in place of an existing instance with the same config, so this shouldn't be subject to firewall issues etc.

We will not allow this thread to be hijacked to troubleshoot Shovels. Use Troubleshooting Networking, collect logs on both sides, and if TLS is used, Troubleshooting TLS. If you find something you cannot explain, start a new discussion.

@couling
Copy link

couling commented Jun 27, 2023

@michaelklishin apologies, I wasn't looking for general troubleshooting only pointing out that the docker image provided here to test MQTT 5 support doesn't seem to work in a way I can test MQTT5 in a way that's meaningful to me.

@alaendle
Copy link

alaendle commented Jul 4, 2023

@lukebakken - also the "standard" mqtt library for JS doesn't seem to be compatible with RabbitMQ (from my perspective due to a bug in mqtt.js mqttjs/mqtt-packet#92). However other broker seem to be more reluctant to protocol violation.

@alaendle
Copy link

alaendle commented Jul 4, 2023

@ansd - And many thanks for implementing my suggestion ❤️ - things now show up as expected:
grafik

ansd added a commit that referenced this issue Jul 4, 2023
The MQTT v5 spec is a bit contradictory and imprecise when it comes to the
Property Length.

It first mandates that if there are no properties, this MUST be
indidated by including a Property Length of 0:
```
2.2.2.1 Property Length
The Property Length is encoded as a Variable Byte Integer. The Property Length
does not include the bytes used to encode itself, but includes the length of
the Properties. If there are no properties, this MUST be indicated by including
a Property Length of zero [MQTT-2.2.2-1].
```

All MQTT packet's Property Length sections that only mention:
```
The length of the Properties in the PUBLISH packet Variable Header encoded as a Variable Byte Integer.
```
So, they follow above requirement.

However, MQTT packets PUBACK, PUBREC, PUBREL, PUBCOMP, and DISCONNECT seem to be exceptions to this rule:
```
3.4.2.2 PUBACK Properties
3.4.2.2.1 Property Length
The length of the Properties in the PUBACK packet Variable Header encoded as a Variable Byte Integer.
If the Remaining Length is less than 4 there is no Property Length and the value of 0 is used.
```

```
3.14.2.2 DISCONNECT Properties
3.14.2.2.1 Property Length
The length of Properties in the DISCONNECT packet Variable Header encoded as a Variable Byte Integer.
If the Remaining Length is less than 2, a value of 0 is used.
```

Since this special case has already been implemented for DISCONNECT, and
RabbitMQ does not support QoS 2, this commit implements this special
case for the PUBACK packet.

Some MQTT clients (e.g. mqttjs) indeed set a Remaining Length of 3 in the PUBACK
packet.

See #2554 (comment)
@ansd
Copy link
Member

ansd commented Jul 4, 2023

Thanks for your feedback @alaendle 🎉
#8752 fixes this issue.

ansd added a commit that referenced this issue Jul 4, 2023
The MQTT v5 spec is a bit contradictory and imprecise when it comes to the
Property Length.

It first mandates that if there are no properties, this MUST be
indidated by including a Property Length of 0:
```
2.2.2.1 Property Length
The Property Length is encoded as a Variable Byte Integer. The Property Length
does not include the bytes used to encode itself, but includes the length of
the Properties. If there are no properties, this MUST be indicated by including
a Property Length of zero [MQTT-2.2.2-1].
```

All MQTT packet's Property Length sections that only mention:
```
The length of the Properties in the PUBLISH packet Variable Header encoded as a Variable Byte Integer.
```
So, they follow above requirement.

However, MQTT packets PUBACK, PUBREC, PUBREL, PUBCOMP, and DISCONNECT seem to be exceptions to this rule:
```
3.4.2.2 PUBACK Properties
3.4.2.2.1 Property Length
The length of the Properties in the PUBACK packet Variable Header encoded as a Variable Byte Integer.
If the Remaining Length is less than 4 there is no Property Length and the value of 0 is used.
```

```
3.14.2.2 DISCONNECT Properties
3.14.2.2.1 Property Length
The length of Properties in the DISCONNECT packet Variable Header encoded as a Variable Byte Integer.
If the Remaining Length is less than 2, a value of 0 is used.
```

Since this special case has already been implemented for DISCONNECT, and
RabbitMQ does not support QoS 2, this commit implements this special
case for the PUBACK packet.

Some MQTT clients (e.g. mqttjs) indeed set a Remaining Length of 3 in the PUBACK
packet.

See #2554 (comment)
@ansd
Copy link
Member

ansd commented Jul 21, 2023

MQTT 5.0 blog post:
https://blog.rabbitmq.com/posts/2023/07/mqtt5

@petersilva
Copy link

Fantastic Progress! I can't use it... as my usage requires shared subscriptions which the announcement says is deferred. I already described a mapping earlier in the thread that should make it straight-forward, as far as I can tell... map shared subscription group names to AMQP queue names, and everything should "just work."

Still pleased to hear of the progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.