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

Add Publisher TopicAddress customizer #1625

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

Conversation

hwoodiwiss
Copy link
Member

This PR adds the required APIs and internals for allowing a publisher to be configured that uses message content to determine the topic ARN to publish to.

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 83.16832% with 17 lines in your changes missing coverage. Please review.

Project coverage is 78.55%. Comparing base (c632bbf) to head (8e54601).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...nt/PublishConfig/DynamicAddressMessagePublisher.cs 74.19% 12 Missing and 4 partials ⚠️
...ishConfig/StaticAddressPublicationConfiguration.cs 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1625      +/-   ##
==========================================
- Coverage   78.56%   78.55%   -0.01%     
==========================================
  Files         141      144       +3     
  Lines        3550     3638      +88     
  Branches      501      507       +6     
==========================================
+ Hits         2789     2858      +69     
- Misses        512      527      +15     
- Partials      249      253       +4     
Flag Coverage Δ
linux 78.44% <83.16%> (-0.12%) ⬇️
macos 45.84% <0.00%> (-1.51%) ⬇️
windows 46.31% <0.00%> (-0.76%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@hwoodiwiss hwoodiwiss marked this pull request as ready for review January 24, 2025 15:15
@hwoodiwiss hwoodiwiss requested a review from a team as a code owner January 24, 2025 15:15
private readonly string _topicArnTemplate = topicArnTemplate;
private readonly ConcurrentDictionary<string, IMessagePublisher> _publisherCache = new();
private readonly ConcurrentDictionary<string, IMessageBatchPublisher> _batchPublisherCache = new();
private readonly ConcurrentDictionary<string, SemaphoreSlim> _topicCreationLocks = new();
Copy link
Member

Choose a reason for hiding this comment

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

Are we OK with these never being disposed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think given Publishers tend to last the lifetime of the application, it should be okay.
To make sure unmanaged resources get cleaned up, SemaphoreSlim also (transiently) uses a SafeHandle, which will also cleanup on finalize.

src/JustSaying/Fluent/TopicAddressPublicationBuilder`1.cs Outdated Show resolved Hide resolved
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