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

Initial implementation of shared subscriptions #796

Merged
merged 19 commits into from
Dec 16, 2023

Conversation

andsel
Copy link
Collaborator

@andsel andsel commented Nov 26, 2023

Release notes

Initial implementation of shared subscription subscribe and publish part.

What does this PR do?

Contains a series of updates to the broker internal structures to sustain shared subscription registering and dispatching of publish messages.

In CTrie's CNode add a separate shared subscriptions data structure to contains the shared subscriptions list related to share name for a given topic filter. It's implemented as a map keyed by share name which maps to a list of shared subscriptions.
Updated the CTrie's insertion method to use a data class SubscriptionRequest to capture the shared and non shared subscription actions.
Implemented test cases to cover the various MQTT spec requirements as integrations tests, and adapted utility classes (like the low level Client to permit the verification).

Why is it important/What is the impact to the user?

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the Changelog if it's a feature or a fix that has to be reported

Author's Checklist

  • complete simple shared subscription phase
  • complete publish phase on shared subscription
  • verify read access also for shared subscriptions, if the topic filter on shared subscription hasn't read permission for the client should it return a SUBACK with negative response? (understand it, and eventually write the integration test the verifies it).
  • when a PUBLISH matches multiple overlapping shared subscriptions then one message per shared is generated.
  • same client sending a new subscribe to same shared topic to update the QoS requested.

How to test this PR locally

Related issues

Use cases

…criptionRequest instead of plain Subscription
…mposed arguments. Introduced specific wrapper class (SubscriptionRequest) to model only the phase of subscription
@andsel andsel self-assigned this Nov 26, 2023
@andsel andsel added the mqtt5 label Dec 11, 2023
@andsel andsel marked this pull request as ready for review December 11, 2023 07:04
@andsel andsel mentioned this pull request Dec 11, 2023
6 tasks
@andsel andsel force-pushed the feature/implement_shared_subscription branch 6 times, most recently from fec45d4 to 25a5d77 Compare December 15, 2023 16:27
@andsel andsel force-pushed the feature/implement_shared_subscription branch from 25a5d77 to d21cd29 Compare December 15, 2023 16:41
@andsel andsel force-pushed the feature/implement_shared_subscription branch from f2f7c5b to 98abd7b Compare December 15, 2023 17:04
…0 when subscribed with QoS0, and after an upgradde of the shared subscription to QoS1, also the published message is reflected
@andsel andsel merged commit b2c5198 into moquette-io:main Dec 16, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant