Skip to content

Operation Queue/Statistics sample #414

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

Closed
wants to merge 10 commits into from

Conversation

TwistedTwigleg
Copy link
Contributor

@TwistedTwigleg TwistedTwigleg commented Mar 9, 2023

Description of changes:

Adds a sample showing how to use the operation statistics support recently added to MQTT311 to implement an operation queue, controlling the flow of operations and ensuring that the MQTT311 connection cannot get too backed up. Additionally, it also allows finer control over the order of operations and the sending rate, as well as providing a way to have assurance that the MQTT311 connection cannot attempt to send too many operations (so long as the operation queue is used instead of the MQTT311 connection directly).

It also adds a test class that tests the operation queue to ensure it works as expected in all cases, as well as a detailed README explaining the sample. The sample and the sample operation queue tests are both run fully in CI.

Finally, it takes the samples in the samples folder and puts each sample in its own folder, along with its own README file instead of having one big file.

  • This makes the samples easier to read without massive amounts of scrolling, as well as allowing us to add extra details where necessary without worry of bloating the markdown file other samples share.
  • However, to share the command_line_utils.py file properly, we have to perform a bit of an ugly hack/workaround that makes a soft-link to the command_line_utils.py file at runtime. Not great, but I couldn't find a nice relative import solution and copying the file for each sample is silly
    • Relative imports didn't work either, even when both the sample and the command_line_utils.py where in their own modules. I couldn't get it working...
    • Because the soft-link is made during runtime, it works fine on Windows thanks to Python3 soft-link support.
    • The .gitignore is set to ignore the softlink files in the samples.

Edit: Splits the README down into per-sample README files into #415. This PR depends on that PR being merged first.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@TwistedTwigleg TwistedTwigleg marked this pull request as ready for review March 10, 2023 17:23
@TwistedTwigleg
Copy link
Contributor Author

Closed for different solution moving forward.

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

Successfully merging this pull request may close these issues.

2 participants