mfontanini / cppkafka

Modern C++ Apache Kafka client library (wrapper for librdkafka)
BSD 2-Clause "Simplified" License
600 stars 206 forks source link

Call flush termination callbacks from sync_produce #263

Closed accelerated closed 4 years ago

accelerated commented 4 years ago

Description Call flush termination callbacks from sync_produce. This allows sync_produce() to exhibit the same behavior as async_produce() when the rd_kafka underlying 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_data pointer 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 asyncproduce can also be called during a flush, not only directly by the producer.

mfontanini commented 4 years ago

I can merge this now if it's ready, I can't follow what this class is doing anymore.

accelerated commented 4 years ago

Sure, thanks! BTW I think the mirror for the rdkafka tarball is broken. There's a fix for this, you should consider merging as it's hard to tell w/o the CI tests.

mfontanini commented 4 years ago

Sorry, I thought there were still other problems on that one. Merged it, can you rebase when you have a chance?

accelerated commented 4 years ago

@mfontanini it's good to go!

mfontanini commented 4 years ago

Thanks sir!