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

SMQ-2546 - Add events to adapters #2659

Merged
merged 6 commits into from
Jan 30, 2025
Merged

Conversation

felixgateru
Copy link
Contributor

@felixgateru felixgateru commented Jan 21, 2025

What type of PR is this?

This is a feature as it adds events to coap and ws and updates events in mqtt.

What does this do?

This pr adds publish, susbscribe and unsubscribe events to the adapters.

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

Have you included tests for your changes?

No

Did you document any new/modified feature?

Yes, in code docuementation is included

Notes

None

@felixgateru felixgateru force-pushed the smq2546-events branch 2 times, most recently from f5d7ba7 to badab49 Compare January 22, 2025 10:08
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 12.42236% with 141 lines in your changes missing coverage. Please review.

Project coverage is 38.97%. Comparing base (3cb41fa) to head (34f71fa).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
pkg/messaging/events/pubsub.go 0.00% 44 Missing ⚠️
mqtt/events/streams.go 0.00% 26 Missing ⚠️
pkg/messaging/events/publisher.go 0.00% 22 Missing ⚠️
mqtt/handler.go 39.13% 8 Missing and 6 partials ⚠️
mqtt/events/events.go 0.00% 13 Missing ⚠️
pkg/messaging/events/events.go 0.00% 13 Missing ⚠️
mqtt/mocks/events.go 55.00% 4 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2659      +/-   ##
==========================================
- Coverage   43.87%   38.97%   -4.90%     
==========================================
  Files         350       59     -291     
  Lines       45718     2876   -42842     
==========================================
- Hits        20059     1121   -18938     
+ Misses      23438     1655   -21783     
+ Partials     2221      100    -2121     

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

@felixgateru felixgateru marked this pull request as ready for review January 22, 2025 10:30
@felixgateru felixgateru requested a review from a team as a code owner January 22, 2025 10:30
ws/handler.go Outdated
Comment on lines 263 to 268
switch {
case strings.HasPrefix(string(s.Password), "Client"):
token = strings.ReplaceAll(string(s.Password), "Client ", "")
default:
token = string(s.Password)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use extractClientSecret instead.

@felixgateru felixgateru force-pushed the smq2546-events branch 2 times, most recently from cf13ed3 to 6bad00d Compare January 27, 2025 07:27

//go:generate mockery --name EventStore --output=../mocks --filename events.go --quiet --note "Copyright (c) Abstract Machines"
type EventStore interface {
Publish(ctx context.Context, clientID, channelID, topic string) error
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use subtopic here, just like in other methods.

http/handler.go Outdated
Comment on lines 199 to 201
if err := h.es.Publish(ctx, clientID, msg.Channel, msg.Subtopic); err != nil {
return errors.Wrap(errFailedPublishEvent, err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Event store should be wrapper around interfaces. I.e. it should be transparent from the adapter implementation because we are using middlewares. Use same approach we have for all the other services.

@felixgateru felixgateru force-pushed the smq2546-events branch 2 times, most recently from c61af1a to dd09cd2 Compare January 28, 2025 04:33
@dborovcanin dborovcanin merged commit 07dbb86 into absmach:main Jan 30, 2025
5 of 8 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.

2 participants