Open JEnoch opened 2 years ago
Hi @Fritiofhedstrom , I'll try to find some time next January to focus back on this MQTT plugin.
Should be fairly easy to implement by just using the querying subscriber from zenoh-ext right?
For a Zenoh Subscriber to receive retained messages published from MQTT and retained by the plugin, yes that would be the way to go.
However, there are still open questions (at least in my mind) on the good way to retain messages in the MQTT plugin (that acts as a broker):
scope
is configured, a MQTT topic name maps to a same Zenoh key expression. It means the Queryable serving the retained messages to QueryingSubscriber shall be on **
. Won't this cause troubles when mixing with another system using other Queryables ?If you can provide some insights on your use case wrt. retain messages in a mix of MQTT and Zenoh application, that could give me some hints for the design! 🙂
Hej Julien! In general we expect it to act as if clients connected to the same broker. No scope would be configured.
Shall they be retained in memory and/or on disk ?
On disk
Shall they be replicated amongst all connected MQTT plugins ?
Yes
In case no scope is configured, a MQTT topic name maps to a same Zenoh key expression. It means the Queryable serving the retained messages to QueryingSubscriber shall be on **. Won't this cause troubles when mixing with another system using other Queryables ?
You are right. We don't plan to use scopes. Perhaps this is just something that users of the plugin would need to be aware of and set up correctly. Potentially the retained database can be using a scope to only serve retained messages.
onMqttSubscribe(topic) {
zenohQuery("retained/$topic").sendToMqttSubscriber()
zenohSubscribe(topic).sendToMqttSubScriber()
}
onMqttPublish(topic, msg) {
zenohPut(topic, msg.payload)
if (msg.isRetained) {
zenohPut("retained/$topic, msg.payload)
}
}
Any idea when this will be implemented? Should be fairly easy to implement by just using the querying subscriber from zenoh-ext right?