eclipse-paho / paho.mqtt.cpp

Other
1.03k stars 438 forks source link

Shared Subscriptions #448

Closed codesian closed 11 months ago

codesian commented 1 year ago

Hi all

Im using Paho main version. I create a server microservice that uses a shared subscription, this process microservices are subscribed to:

$shared/group/myservice

A cliente push a message to myservice and not works.

Im initializing Paho Client with MQTT_5 support.

auto connOpts = mqtt::connect_options_builder()
                .mqtt_version(MQTTVERSION_5)
                .clean_start(true)
                .automatic_reconnect(true)
                .password(mqtt.user)
                .user_name(mqtt.pass)
                .keep_alive_interval(5)
                .will(this->getLastWill())
                .finalize(); 

Any help? Thanks

fpagliughi commented 11 months ago

Shared subscriptions came to the MQTT protocol in v5, but several brokers were supporting them before that. So you may see some differences in the brokers, but they should behave similarly if you connect using v5.

Here's a blog post about how to use them with Mosquitto: https://cedalo.com/blog/mqtt-shared-subscriptions-guide/

Look up specifics for the broker that you're using.

fpagliughi commented 11 months ago

If there's still a problem, feel free to re-open this.