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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(shared_sub): restore support for $queue/ shared subscription #11281

Merged

Conversation

thalesmg
Copy link
Contributor

@thalesmg thalesmg commented Jul 17, 2023

targeting release-51

Partially addresses: https://emqx.atlassian.net/browse/EMQX-4589

There's still a problem with the handling of shared groups that is not particular to the $queue/ syntax and preexistent that the same client cannot subscribe to different groups that have the same topic filter.

Summary

馃 Generated by Copilot at 1e7e080

This pull request implements the queue subscription feature, which allows clients to subscribe to a topic as a queue group and receive messages in a load-balanced way. It modifies the emqx.hrl, emqx_topic.erl, and emqx_mgmt_api_subscriptions.erl files to handle the new $queue topic prefix and the related options. It also updates and adds test cases in emqx_shared_sub_SUITE.erl, emqx_topic_SUITE.erl, and emqx_proper_types.erl to test the new feature and ensure its correctness.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Changed lines covered in coverage report
  • Change log has been added to changes/(ce|ee)/(feat|perf|fix)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • If there should be document changes, a PR to emqx-docs.git is sent, or a jira ticket is created to follow up
  • [na] Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • [na] If changed package build workflow, pass this action (manual trigger)
  • [na] Change log has been added to changes/ dir for user-facing artifacts update

Partially addresses: https://emqx.atlassian.net/browse/EMQX-4589

There's still a problem with the handling of shared groups that is
_not particular to the `$queue/` syntax_ and preexistent that the same
client cannot subscribe to _different groups_ that have the same
_topic filter_.
@thalesmg thalesmg force-pushed the restore-queue-shared-sub-r51-20230717 branch from 1e7e080 to 1fdcfba Compare July 17, 2023 19:41
@thalesmg thalesmg marked this pull request as ready for review July 18, 2023 12:15
@thalesmg thalesmg requested review from a team, lafirest and sstrigler as code owners July 18, 2023 12:15
@thalesmg
Copy link
Contributor Author

The issue about unsubscribing to shared topics and subscribing to different groups/same topic filters is tracked by https://emqx.atlassian.net/browse/EMQX-9876, and there's some progress here: #10976

Copy link
Contributor

@keynslug keynslug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃憤馃徏

Comment on lines 191 to 193
emqx_topic:join([<<"$share">>, Group, Topic]);
filename:join([<<"$share">>, Group, Topic]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not what we want, i.e. emqx_topic:join/1 is the proper way to do things here. Otherwise, the results will be different between Linux and Windows for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

鉁旓笍

@@ -986,6 +988,112 @@ t_session_kicked(Config) when is_list(Config) ->
?assertEqual([], collect_msgs(0)),
ok.

%% FIXME: currently doesn't work
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe add why it's not working (or what it needs to work)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few comments in other places, and the PR number can be referenced from the merge commit, I guess.

@thalesmg thalesmg merged commit 4ec4041 into emqx:release-51 Jul 18, 2023
117 checks passed
@thalesmg thalesmg deleted the restore-queue-shared-sub-r51-20230717 branch July 18, 2023 16:52
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.

None yet

4 participants