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

buffer strategy for QOS>0 messages #856

Open
dakhnod opened this issue Jul 26, 2024 · 1 comment
Open

buffer strategy for QOS>0 messages #856

dakhnod opened this issue Jul 26, 2024 · 1 comment
Labels
Status: Available No one has claimed responsibility for resolving this issue. Type: Enhancement A new feature for a minor or major release.

Comments

@dakhnod
Copy link

dakhnod commented Jul 26, 2024

In my application. I am publishing sensor data and need to buffer messages in case connection is temporarily lost.
Thus, I am sending my data with QOS 2.
I limited the number of queued message in case of disconnection via max_queued_messages_set().

Now, If I got it right, here is what happens when the buffer runs full: all newer messages get discarded.
So, with a limit of 5, if I publish 1 2 3 4 5 6 7 8 9 0, after reconnection these messages get delivered: 1 2 3 4 5.

For me, it would be more useful if the buffer would be circularly rewritten, so the newest 5 messages are queued.

Is there a way to set this up?

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Jul 26, 2024
@MattBrittan MattBrittan added the Type: Enhancement A new feature for a minor or major release. label Jul 29, 2024
@MattBrittan
Copy link
Contributor

Currently this is a fairly simple check

 if self._max_queued_messages > 0 and len(self._out_messages) >= self._max_queued_messages:
                    message.info.rc = MQTTErrorCode.MQTT_ERR_QUEUE_SIZE
                    return message.info

So the library does not offer the functionality you are looking for and I've tagged this as an enhancement request (feel free to submit a PR if it's something you wish to implement).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Available No one has claimed responsibility for resolving this issue. Type: Enhancement A new feature for a minor or major release.
Projects
None yet
Development

No branches or pull requests

2 participants