dotnet / MQTTnet

MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
MIT License
4.41k stars 1.06k forks source link

Load Balancing With Shared Subscriptions - MQTT Client #821

Open vitaly-trevidi opened 4 years ago

vitaly-trevidi commented 4 years ago

Dear Developers and founders of MQTTnet project!

First of all, let me express my personal apprisiation to you guys! This project has an extreamly high impact on our dependent projects we workin on. This one is the one of best toys we ever used in our Message Queueing world. Extreamly relieble, easy to use, and easy to embed!

Everything is perfect but one of the fetures of MQTT v5 would be great to have at the Client/ManagedClient supported by Server.

The fearure we really need is called - Load Balancing With Shared Subscriptions intoduced by The HiveMQ Team. https://www.hivemq.com/blog/mqtt-client-load-balancing-with-shared-subscriptions/

We can cover some functionaly of this by dedicated Client Subscriptions and publishing to dedicated Topics, or use Application Message Interseptor on Server side, but those methods are not very ellegant and eating some extra machine resources.

In our projects we have a requirement to implement multy-threded Client. 10 objects Subscribe to single shared topic. Expected behavior just like JMS Queue, which delivers the first message in the queue to just one session, the second message in the queue to the most Idle session and so on (load balanser).

chkr1011 commented 4 years ago

Hi, thank you for your feedback. At the moment we have no time left to implement more MQTTv5 features. But I assume this will change in a couple of months. If you have some experience with this please consider making an proposal via pull request. Best regards Christian

rquackenbush commented 4 years ago

Would like to add my voice to this... Both for this being a great library and for the load balancing with shared subscriptions for this feature. I don't feel I understand MQTT 5 quite well enough to contribute a pull request at this time, but that might change.

rdinogit commented 4 years ago

I would also like to show my interest towards this feature. And I also feel like I do not yet have enough knowledge to be able to contribute with a pull request. Congratulations for the amazing library!

redradist commented 4 years ago

Guys, is this topic relate to load balancing with MQTT ? Seems like this is Load Balancing with additional feature like shared subscription ... I have created topic https://github.com/chkr1011/MQTTnet/issues/983 related how to create Load Balancing with MQTTnet ... in documentation I have not found any useful information ... is there solution for this issue ?

SeppPenner commented 4 years ago

I have tried to do something like this, but it's not yet finished: https://github.com/SeppPenner/NetCoreMQTTExampleCluster

rshillington commented 2 years ago

I stumbled across this issue and all I can add is that with version 4.1.0.247 I have no problem subscribing to a topic such as: $share/group/topic I tested this against the free HiveMQ broker. So perhaps there really isn't an issue any more with shared subscriptions, and this issue could be closed?

chkr1011 commented 2 years ago

Shared subscriptions are working fine when using the client only. The feature is not (yet) implemented for the server.

kanilsz commented 1 year ago

@chkr1011 Excuse me but whether it would work with ManagedMqttClient to Solace? And is any example of how to use shared subs?

rshillington commented 1 year ago

I have confirmed this does work with the ManagedMqttClient (using HiveMQ as the broker)

ES0T commented 1 year ago

I know this topic hasn't been updated in a year, but can anyone confirm any special string escaping needing with this library? Is this C# string literal topic supposed to work? $share/group/topic

Edit : Yes, it does. (Sorry, ignore)

kanilsz commented 8 months ago

Should this issue be closed? Because such a feature has already implemented.