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

New event to handle Metadata update #332

Merged
merged 6 commits into from
Dec 18, 2023
Merged

New event to handle Metadata update #332

merged 6 commits into from
Dec 18, 2023

Conversation

Gsantomaggio
Copy link
Member

@Gsantomaggio Gsantomaggio commented Dec 12, 2023

With this PR #328 the client can handle multi-producers and consumers per connection.

This PR removes MetadataHandler and introduces OnMetadataUpdate event.

The event can handle multiple Metadata updates coming from the server. Metadata update is raised when a stream is deleted, or a replica is removed.

The server automatically removes the producers and consumers linked to the connection, here we need to remove these entities from the internal pool to be consistent.

How to test

  • You need a cluster
  • Use RawProducer and RawConsumer bind to one or more streams. Delete the streams and the client has to remove all the connections
  • Use Producer and Consumer in a cluster remove a replica the Producer and Consumer should reconnect and continue to work

Refactor

Refactor RawConsumer and RawProducer in this commit. Remove duplication code. Move the common code to the AbstractEntity Class

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
event. The event is needed to handle multi producers and multi consumers per connection.

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Attention: 69 lines in your changes are missing coverage. Please review.

Comparison is base (4601429) 92.49% compared to head (6443dc3) 92.92%.
Report is 2 commits behind head on main.

Files Patch % Lines
RabbitMQ.Stream.Client/RawConsumer.cs 77.88% 17 Missing and 6 partials ⚠️
RabbitMQ.Stream.Client/AbstractEntity.cs 67.44% 11 Missing and 3 partials ⚠️
RabbitMQ.Stream.Client/Client.cs 88.52% 5 Missing and 9 partials ⚠️
RabbitMQ.Stream.Client/ConnectionsPool.cs 90.67% 1 Missing and 10 partials ⚠️
RabbitMQ.Stream.Client/RawProducer.cs 95.23% 3 Missing ⚠️
RabbitMQ.Stream.Client/StreamSystem.cs 90.47% 0 Missing and 2 partials ⚠️
RabbitMQ.Stream.Client/MetaData.cs 66.66% 0 Missing and 1 partial ⚠️
Tests/SuperStreamConsumerTests.cs 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #332      +/-   ##
==========================================
+ Coverage   92.49%   92.92%   +0.42%     
==========================================
  Files         113      115       +2     
  Lines        9946    10845     +899     
  Branches      825      878      +53     
==========================================
+ Hits         9200    10078     +878     
- Misses        567      574       +7     
- Partials      179      193      +14     

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

@Gsantomaggio Gsantomaggio changed the title Metadata update New event to handle Metadata update Dec 13, 2023
@Gsantomaggio Gsantomaggio marked this pull request as ready for review December 13, 2023 08:07
@Gsantomaggio
Copy link
Member Author

@jonnepmyra FYI

@Gsantomaggio Gsantomaggio marked this pull request as draft December 13, 2023 13:05
Remove duplication code between the Raw* classes and moved to
AbstractEntity class.

Fix a rare condition where the producer still receive confirmation but
the producer was removed from the internal list due of cancellation.

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio Gsantomaggio marked this pull request as ready for review December 14, 2023 12:38
@Gsantomaggio Gsantomaggio requested a review from Zerpet December 15, 2023 13:45
Zerpet
Zerpet previously approved these changes Dec 15, 2023
RabbitMQ.Stream.Client/Client.cs Outdated Show resolved Hide resolved
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio Gsantomaggio merged commit d5cdce4 into main Dec 18, 2023
2 checks passed
@Gsantomaggio Gsantomaggio deleted the metadata_update branch December 18, 2023 08:22
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