Added flush/produce termination callbacks #148
Merged
+75
−6
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.
Added
BufferedProducer::FlushTerminationCallback
.Reason:
FlushFailureCallback
can be called multiple times subject to the number of retries set. However, the application has no way of knowing how many retries are left (the retry count is not passed into theFlushFailureCallback
) so unless it keeps track via a map or some other logic of each message retry count it cannot detect when a message will be dropped. This makes message accounting tedious and complex.ProduceFailureCallback
cannot be called because we cannot build aMessage
object w/o a valid rdkafka handle. The application may also need to do some cleanup of theopaque
data it has passed. Otherwise this data can be leaked. Also the application can keep stats of how many messages fail or perhaps re-publish them into another kafka queue, log them, etc. And for that theFlushFailureCallback
is insufficient.ProduceFailureCallback
vsProduceTerminationCallback
pair.