Skip to content

feat: provides api to register a callbacks #2055

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

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

Conversation

saadmar
Copy link
Contributor

@saadmar saadmar commented Jan 17, 2023

  • Extends the MessageProducer api to register a callback when using a non blocking producer.
  • Adds standard error logging for non blocking producers

We had a use case where a producer silently failed to produce a message (due to large size) and there was no trace for that as everything happens in a separate thread.

Another option for us could be blocking the thread and explicitly logging the exception, but we thought that could be good to have for all cases.

@saadmar saadmar requested a review from a team as a code owner January 17, 2023 13:41
@github-actions
Copy link
Contributor

github-actions bot commented Jan 17, 2023

Unit Test Results

0 tests  ±0   0 ✔️ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ±0 

Results for commit 2c10cef. ± Comparison against base commit 934f37b.

♻️ This comment has been updated with latest results.

Comment on lines +76 to +81
assertThat(out.capturedLines())
.anyMatch(l -> l.contains(statement))
.anyMatch(
l ->
l.contains(
"An error occurred while producing a message with key k to the topic test-topic."));
Copy link
Contributor

Choose a reason for hiding this comment

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

Above it is documented, that the callback is called when the message is sent. In my understanding that means success, but here you verify that the callback is called and that an error occurred. That seems to be different to the documentation. Can you explain that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, the documentation is not accurate, this should be triggered in both cases "when the request is complete".
Changed

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

90.9% 90.9% Coverage
0.0% 0.0% Duplication

@JoergSiebahn JoergSiebahn requested a review from a team as a code owner May 7, 2025 07:43
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