Call flush termination callbacks from sync_produce #263
+51
−11
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.
** Description **
Call flush termination callbacks from sync_produce. This allows
sync_produce()to exhibit the same behavior asasync_produce()when therd_kafkaunderlying layer throws an error upon production. Flush callbacks, if registered, will now be called in both cases.If the application passed some opaque correlation data via the
user_datapointer and expected the delivery callback to be triggered on success or failure, in the failure case, this was not guaranteed to happen depending on the error type. For instance producing to a bad topic name, would cause all flushes to throw and no callbacks were ever invoked.Note that sync_produce as well as async_produce can also be called during a flush, not only directly by the producer.