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

feat: add RabbitMQ bridge #10534

Merged
merged 1 commit into from
May 9, 2023

Conversation

kjellwinblad
Copy link
Contributor

@kjellwinblad kjellwinblad commented Apr 26, 2023

Fixes https://emqx.atlassian.net/browse/EMQX-9087

Summary

🤖 Generated by Copilot at 3c0677b

This pull request adds a new feature to EMQX that allows it to communicate with RabbitMQ brokers using the bridge mechanism. It introduces a new application emqx_bridge_rabbitmq that implements the logic and configuration for the RabbitMQ bridge type. It also updates the existing modules and files to support the new feature, such as emqx_ee_bridge, emqx_resource, mix.exs, and rebar.config.erl. It provides documentation, internationalization, and common test cases for the RabbitMQ bridge feature. It also adds a docker-compose service for RabbitMQ to facilitate testing.

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
  • Schema changes are backward compatible

@kjellwinblad
Copy link
Contributor Author

Setting the PR to draft as I have not made the change log entry yet.

Copy link
Contributor Author

@kjellwinblad kjellwinblad left a comment

Choose a reason for hiding this comment

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

Thanks for very good comments. I have addressed most in a new commit and have added questions about the remaining ones.

@kjellwinblad kjellwinblad marked this pull request as ready for review May 2, 2023 10:02
@kjellwinblad kjellwinblad requested a review from a team as a code owner May 2, 2023 10:02
@kjellwinblad kjellwinblad requested a review from JimMoen as a code owner May 3, 2023 08:31
@kjellwinblad
Copy link
Contributor Author

Rebased and force pushed to remove merge conflicts with master.

@kjellwinblad kjellwinblad force-pushed the kjell/bridge/rabbitmq branch 3 times, most recently from 1fbea5e to aee62e9 Compare May 8, 2023 06:22
@coveralls
Copy link
Collaborator

coveralls commented May 8, 2023

Pull Request Test Coverage Report for Build 4916612514

  • 100 of 124 (80.65%) changed or added relevant lines in 4 files are covered.
  • 41 unchanged lines in 15 files lost coverage.
  • Overall coverage decreased (-0.05%) to 81.59%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/emqx_bridge_rabbitmq/src/emqx_bridge_rabbitmq.erl 13 16 81.25%
apps/emqx_bridge_rabbitmq/src/emqx_bridge_rabbitmq_connector.erl 83 104 79.81%
Files with Coverage Reduction New Missed Lines %
apps/emqx_authn/src/enhanced_authn/emqx_enhanced_authn_scram_mnesia.erl 1 85.29%
apps/emqx_gateway_mqttsn/src/emqx_mqttsn_frame.erl 1 64.61%
apps/emqx/src/emqx_broker.erl 1 87.64%
apps/emqx/src/emqx_flapping.erl 1 87.27%
apps/emqx/src/emqx_logger.erl 1 80.49%
apps/emqx/src/emqx_router_helper.erl 1 86.27%
apps/emqx/src/emqx_schema.erl 1 87.5%
apps/emqx/src/emqx_banned.erl 2 89.39%
apps/emqx/src/emqx_cm.erl 2 91.44%
apps/emqx_resource/src/emqx_resource_buffer_worker.erl 3 94.89%
Totals Coverage Status
Change from base Build 4915258169: -0.05%
Covered Lines: 26209
Relevant Lines: 32123

💛 - Coveralls

apps/emqx_dashboard/src/emqx_dashboard_swagger.erl Outdated Show resolved Hide resolved
false
end,
true = lists:any(IsRightName, Bridges),
delete_bridge(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is always called, perhaps we could add this to end_per_testcase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In two test cases (t_make_delete_bridge and t_make_delete_bridge_non_existing_server) it is not called last (as these test cases checks that the delete had the desired effect) and I think there is some advantage to have it directly in the test cases as it makes it more explicit what the test case is doing. I have no strong feelings about this so I can make the change, if you insist that it should be in end_per_testcase.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's fine for those two that explicitly test that behavior.

But we always want to clear all bridges during test teardown to avoid flakiness, so I think it's a good practice to do that even if there are no bridges left to delete.

thalesmg
thalesmg previously approved these changes May 8, 2023
false
end,
true = lists:any(IsRightName, Bridges),
delete_bridge(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's fine for those two that explicitly test that behavior.

But we always want to clear all bridges during test teardown to avoid flakiness, so I think it's a good practice to do that even if there are no bridges left to delete.

@kjellwinblad kjellwinblad merged commit 954eef8 into emqx:release-50 May 9, 2023
134 checks passed
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

5 participants