Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support retained messages #6

Open
JEnoch opened this issue Oct 26, 2022 · 3 comments
Open

Support retained messages #6

JEnoch opened this issue Oct 26, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@JEnoch
Copy link
Member

JEnoch commented Oct 26, 2022

No description provided.

@JEnoch JEnoch added the enhancement New feature or request label Oct 26, 2022
@Fritiofhedstrom
Copy link

Any idea when this will be implemented? Should be fairly easy to implement by just using the querying subscriber from zenoh-ext right?

@JEnoch
Copy link
Member Author

JEnoch commented Nov 24, 2023

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):

  • Shall they be retained in memory and/or on disk ?
  • Shall they be replicated amongst all connected MQTT plugins ?
  • 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 ?
  • In MQTT it's up to the Publisher to declare that a publication shall be retained. There is no equivalent in Zenoh, since we preferred to let this decision at deployment time via the creation of Storages that can retain any publication. Does this imply that to retain messages from a Zenoh Publisher for a MQTT Subscriber the user shall configure some Storage (external or internal to the MQTT plugin) ?

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! 🙂

@Fritiofhedstrom
Copy link

Fritiofhedstrom commented Dec 21, 2023

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)
      }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants