-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Introduce Kafka::asyncPublish()
#312
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…hSend but only once when the application is terminating (#310) * upd: async production (that has only one flush at the end of the application) [see discussion #309] * fix: added broker parameter to the facade helper [see discussion #309] * ref: simplify Builder construct extension [see discussion #309] --------- Co-authored-by: Alexander (SASh) Alexiev <[email protected]>
mateusjunges
changed the title
Introduce
Introduce Aug 13, 2024
Kafka::asyncPublish()
Kafka::asyncPublish()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces async producers. The producer builder is created when you first call
Kafka::asyncPublish
. The first message sent will create a producer, which will be stored in memory together with the builder. This means that the same builder/producer will be used during the request, even if you have multiple calls toKafka::asyncPublish
.With async publishing, the producer will be flushed at the end of your request when the app is terminating, instead of flushing after every single message you send.
Benchmark
Before this PR, it takes ~
1512ms
to send 1000 messages to a kafka topic.After this is merged, this time decreases to ~
20ms