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

NOISSUE - Use RabbitMQ as MQTT broker #2695

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

rodneyosodo
Copy link
Member

What type of PR is this?

This is a feature because it adds the following functionality: Add RabbitMQ as a MQTT broker.

What does this do?

The changes update the MQTT adapter and Docker configurations across the project. In the MQTT adapter, new configuration fields, a connection interceptor, and enhanced publisher/forwarder logic have been introduced, including authentication and QoS support. Docker-related files have been modified to integrate RabbitMQ as the MQTT broker, with updated environment variables, deployment documentation, and RabbitMQ-specific settings. Additional improvements include new tracing middleware for MQTT forwarding, updated dependency versions, and comprehensive tests for the MQTT pub/sub functionality using Docker.

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Yes, I have included tests for my changes. I have tested MQTT pubsub, COAP pubsub and HTTP pub. WS will be fixed in another PR

Did you document any new/modified feature?

Notes

@rodneyosodo rodneyosodo requested a review from a team as a code owner February 10, 2025 11:41
@rodneyosodo rodneyosodo force-pushed the rabbitmq branch 3 times, most recently from 49dfbb5 to 518b59e Compare February 10, 2025 11:48
Copy link

codecov bot commented Feb 10, 2025

Codecov Report

Attention: Patch coverage is 46.95652% with 122 lines in your changes missing coverage. Please review.

Project coverage is 34.60%. Comparing base (597ad23) to head (db4a8ae).

Files with missing lines Patch % Lines
pkg/messaging/mqtt/pubsub.go 71.83% 27 Missing and 13 partials ⚠️
mqtt/forwarder.go 0.00% 31 Missing ⚠️
mqtt/tracing/forwarder.go 0.00% 31 Missing ⚠️
pkg/messaging/mqtt/publisher.go 23.07% 18 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2695      +/-   ##
==========================================
- Coverage   42.28%   34.60%   -7.68%     
==========================================
  Files         349      252      -97     
  Lines       47349    38518    -8831     
==========================================
- Hits        20021    13329    -6692     
+ Misses      25154    24125    -1029     
+ Partials     2174     1064    -1110     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rodneyosodo rodneyosodo force-pushed the rabbitmq branch 3 times, most recently from 1fa3a37 to e98d585 Compare February 11, 2025 10:29
@dborovcanin
Copy link
Collaborator

@rodneyosodo Please rebase.

Comment on lines +228 to +231
interceptor := interceptor{
username: cfg.MQTTTargetUsername,
password: cfg.MQTTTargetPassword,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this interceptor to set username and password?

Copy link
Member Author

Choose a reason for hiding this comment

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

RabbitMQ runs in two modes, with and without authentication. For our case devices, i.e, clients always have authentication (thingID and thingKey). So we either add the RabbitMQ username and password when sending the request or remove the username and password when forwarding the request to RabbitMQ

@rodneyosodo rodneyosodo force-pushed the rabbitmq branch 2 times, most recently from a6b294f to db4a8ae Compare February 12, 2025 11:13
This reverts commit cff6e7f.

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
This reverts commit 87db3e6.

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Use rabbitMQ alpine rather than management-alpine since we are enabling
that feature using config files

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
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