mosquitto icon indicating copy to clipboard operation
mosquitto copied to clipboard

plugins can modify outgoing messages and subscriptions

Open abiliojr opened this issue 2 years ago • 6 comments

These changes allow plugins to modify outgoing messages, and subscription topics/qos. Some features that could be built using this changes:

  • Dynamically limit the subscription QoS for some clients (example included)
  • Topic remapping/jailing (example included)
  • MQTT v5 to v3.1.1 translation: properties might be placed in the payload for v3.1.1 clients
  • Compression/decompression of retained messages: might be useful on big size/low throughput applications
  • Selective modification of properties based on the destination

Thank you for contributing your time to the Mosquitto project!

Before you go any further, please note that we cannot accept contributions if you haven't signed the Eclipse Contributor Agreement. If you aren't able to do that, or just don't want to, please describe your bug fix/feature change in an issue. For simple bug fixes it is can be just as easy for us to be told about the problem and then go fix it directly.

Then please check the following list of things we ask for in your pull request:

  • [x] Have you signed the Eclipse Contributor Agreement, using the same email address as you used in your commits?
  • [x] Do each of your commits have a "Signed-off-by" line, with the correct email address? Use "git commit -s" to generate this line for you.
  • [x] If you are contributing a new feature, is your work based off the develop branch?
  • [ ] If you are contributing a bugfix, is your work based off the fixes branch?
  • [x] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [x] Have you successfully run make test with your changes locally?

abiliojr avatar Mar 14 '22 07:03 abiliojr

First time looking at mosquitto code so sorry for my lack of understanding, but my questions is: Would this allow for making changes like adding a new property to an mqtt5 message. I want my bridge on the edge to add timestamps to sensor data before sending it to the cloud.

Edit 1: May be this is what I need: https://github.com/eclipse/mosquitto/blob/master/plugins/message-timestamp/mosquitto_message_timestamp.c

wickywaka avatar May 17 '22 11:05 wickywaka

I believe these changes will allow you to timestamp outgoing messages only. Of course, you don't want to timestamp all the messages, just the ones going to the cloud. This means you will have to filter by something like clientid (and assign a well known clientid to your bridge connection).

abiliojr avatar Jun 09 '22 06:06 abiliojr

This looks like a good idea and can actually work in a cleaner way. Thanks. Also thanks for the reply in the mailing list, it was in my spam.

wickywaka avatar Jun 09 '22 22:06 wickywaka

Hi @ralight, I also think this is a reasonable and helpful addition from @abiliojr (thank you!). What would need to happen to get this in?

chrblabla avatar Jun 10 '22 13:06 chrblabla

up to date with develop

abiliojr avatar Jun 25 '22 14:06 abiliojr

Sorry, but when this feature will be merged into master? And, when will the new release of Mosquitto?

Nikolay-Ch avatar Jul 30 '22 09:07 Nikolay-Ch

This has been merged, but github hasn't recognised it as being merged for some reason.

ralight avatar Apr 07 '23 18:04 ralight