spring-projects / spring-integration

Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns (EIP)
http://projects.spring.io/spring-integration/
Apache License 2.0
1.54k stars 1.1k forks source link

Consider to move MQTT support to HiveMQ MQTT Client #3102

Open artembilan opened 4 years ago

artembilan commented 4 years ago

This client support both MQTT v3.1.1 and v5 protocol and it is Java 8 and Reactive ready: https://github.com/hivemq/hivemq-mqtt-client

Unlike Paho which is not clear when will support v5: https://github.com/eclipse/paho.mqtt.java/blob/master/MQTTv5.md

Although I might agree that this could be something for version 6.0 or we can support both clients since 5.3...

smaugs commented 3 years ago

+1

oxcafedead commented 3 years ago

Paho supports v5 already :)

artembilan commented 3 years ago

@oxcafedead ,

doesn't look like: https://www.eclipse.org/paho/index.php?page=clients/java/index.php.

Probably they have plans for that support, but no official release yet.

Thanks

oxcafedead commented 3 years ago

@artembilan,

strange, because the initial link brought by you in the issue states v5 support :) https://github.com/eclipse/paho.mqtt.java/blob/master/MQTTv5.md also: https://github.com/eclipse/paho.mqtt.java/releases/tag/v1.2.5

artembilan commented 3 years ago

Thank you for the pointer, @oxcafedead !

released this on Jul 14

So, that happened recently.

Anyway I see that we need to build v5-compatible channel adapters to support a new artifact from them.

On the other hand Hive also have different packages (probably with different API) for v3 & v5, respectively.

Although I still tended to move to Hive client since they have Reactor API for us.

Only the problem not clear when I will have time and resources to just into this issue.

Contributions are welcome!

vivianazimbone commented 2 years ago

Paho still not fully supports v5 and the latest version dates back to July 2020...

artembilan commented 2 years ago

Hi @vivianazimbone !

would you mind to elaborate more what exactly Paho does not support yet for v5 protocol?

Thanks

albert-hoffmann commented 1 year ago

Hi, shared subscriptions are still not working with the latest paho client. The $share prefix is not handled correctly on incoming messages and the messages are not routed to the internal subscriber by the client implementation.

Also, when the broker goes down, the MQTTv5 client does not reconnect correctly, at least when using the ClientManager for several internal message consumers.

artembilan commented 1 year ago

Here is some discussion about $share: https://stackoverflow.com/questions/75950944/shared-subscription-with-spring-integration-mqttv5-not-receiving-messages. Not Spring Integration related, though.

Not sure what is your problem with reconnecting, but here is a test we check that behavior with: https://github.com/spring-projects/spring-integration/blob/main/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/Mqttv5BackToBackAutomaticReconnectTests.java.

More over this does not sound like related to the HiveMQ issue we are talking here about...

Please, consider to raise a separate issue about your ClientManager problem and share some code to let us reproduce and confirm the issue and possible fix in the end.

wilx commented 6 months ago

It seems to me the Paho project is somewhat dead, or at least the Java client side of it. There has been zero activity for 2 years in its Git repository, except for a single commit recently related to some Eclipse bureaucracy. Replacing Paho with anything else in Spring Integration will require quite a lot of changes as the MQTT support in Spring Integration relies on it heavily. My project can live with Paho in Spring Integration for now but it does not seem to be a viable client in the long term.

artembilan commented 6 months ago

Yes, we are OK to migrate to Hive MQTT client, but we don't have resources right now to look into that. The contribution is welcome: https://github.com/spring-projects/spring-integration/blob/main/CONTRIBUTING.adoc