Skip to content

Conversation

@joaofbantunes
Copy link
Member

This PR introduces a mechanism to collect and retry persisting the information that some messages were successfully produced to the application's message broker.

The idea is o minimize the occurrence of duplicated message production. This could happen if after producing the messages, something goes wrong when connecting to the database.

This implementation is a best effort one, in that the produced messages are kept in memory to retry completion. If the process restarts or if there's a concurrent process, messages will still be produced again.

Closes #41

@joaofbantunes joaofbantunes requested a review from Copilot June 20, 2025 11:38

This comment was marked as outdated.

@joaofbantunes joaofbantunes requested a review from Copilot June 28, 2025 12:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a mechanism to collect and retry completing successfully produced messages in order to minimize duplicates that could occur when the message completion (e.g. persistence) fails due to transient errors. Key changes include:

  • Renaming of helper classes and updating references from BatchFetcherTestHelpers to TestHelpers in tests for both PostgreSQL and MySQL providers.
  • Introduction of a new BatchCompleter along with an IBatchCompleteRetrier interface along with corresponding tests and dependency injection registrations for PostgreSQL, MySQL, and MongoDB providers.
  • Updates to producer and background service implementations to utilize the new completion retry mechanism and associated metrics.

Reviewed Changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.

File Description
tests/**/*.cs Renames and updates helper class references for consistency.
src//Polling/*.cs and src//ConfigurationExtensions.cs Integrates the BatchCompleter and IBatchCompleteRetrier in providers’ DI setup.
src/Core/Polling/PollingProducer.cs & PollingBackgroundService.cs Modifies producer and background service to use the new retry mechanism.
docs/building-a-provider/*.md Updates documentation to mention the retry mechanism and IBatchCompleteRetrier.
Comments suppressed due to low confidence (1)

docs/building-a-provider/push.md:7

  • [nitpick] Consider removing the informal emoji to maintain a professional tone in the documentation.
🚧 coming soon (maybe 😂)

@joaofbantunes joaofbantunes merged commit 8145002 into main Jun 28, 2025
1 check passed
@joaofbantunes joaofbantunes deleted the retry-message-complete branch June 28, 2025 14:37
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.

Introduce mechanism to retry completing already produced messages

2 participants