hono icon indicating copy to clipboard operation
hono copied to clipboard

Support MQTT 5 in MQTT protocol adapter

Open sophokles73 opened this issue 4 years ago • 5 comments

Vert.x 4.2 introduced support for MQTT 5 on the server side. Would be nice to support it in the MQTT adapter.

sophokles73 avatar Nov 18 '21 08:11 sophokles73

I started to look at MQTT 5 support but on very basic level and without adding much MQTT 5 features in the mix. However I'm not exactly sure what kind of MQTT 5 support we are looking into Hono in this issue?

And integration tests should be rewritten almost altogether from scratch using some other MQTT client than Vert.x since it does not support MQTT 5 at all if I understood correctly.

harism avatar Aug 16 '24 20:08 harism

@harism thanks for taking interest in this issue :+1: FMPOV the first step would be to allow devices to connect using MQTT 5 at all. It would be nice if the MQTT3 property bag could be replaced with MQTT5 message properties, though. APart from that, I would be more than happy with the same behavior as with MQTT3. WDYT?

Regarding the integration tests: You are right and IMHO we should switch to Eclipse Paho. But that can be done in a second step.

sophokles73 avatar Aug 20 '24 16:08 sophokles73

@harism thanks for taking interest in this issue 👍 FMPOV the first step would be to allow devices to connect using MQTT 5 at all. It would be nice if the MQTT3 property bag could be replaced with MQTT5 message properties, though. APart from that, I would be more than happy with the same behavior as with MQTT3. WDYT?

MQTT5 seems to be heavily backwards compatible with MQTT3 and it seems likely that PropertyBag cannot be replaced but instead MQTT5 message MqttProperties can be utilised as an alternative for providing similar information. And I continued my PR with a small change to allow Content-Type to be shared this way from MQTT5 clients now first.

Also to my best understanding MQTT5 clients should work already now with the current release too but there is just not support for any MQTT5 features yet. I've been using MQTTX in MQTT5 mode at least with Hono MQTT adapter successfully in same way MQTT3 works currently too.

Regarding the integration tests: You are right and IMHO we should switch to Eclipse Paho. But that can be done in a second step.

Sounds good to me, basically the need arises along with more advanced MQTT5 features use.

harism avatar Aug 24 '24 18:08 harism

Oops I didn't notice to force push changes I referred to in previous reply. There are one or two places to add similar simple read from MqttProperties instead of relying to PropertyBag values only.

harism avatar Aug 28 '24 06:08 harism

@sophokles73 that is a nice addition to determine MQTT311 vs MQTT5 client support version, I thought this is not doable.

Now having this flag it should be possible to fix one of the MQTT5 implementations I needed to overlook earlier on this line of MQTT abstract adapter;

https://github.com/eclipse-hono/hono/blob/master/adapters/mqtt-base/src/main/java/org/eclipse/hono/adapter/mqtt/AbstractVertxBasedMqttProtocolAdapter.java#L1754

Here those command details could be sent as MqttProperties which is possibly a bit more of a MQTT5 way of doing so.

harism avatar Dec 14 '24 09:12 harism