-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KafkaProducer: Expose
run()
method (#63)
* KafkaProducer: Expose `run()` method Motivation: * Our current implementation of polling `librdkafka` for new message acknowledgements in `KafkaProducer` did not support backpressure. Also, it made use of some `weak` references which we generally want to avoid due to performance reasons. Modifications: * fix typo in `SwiftKafkaTests` * upgrade minimum OS versions to support the `Duration` type * move conversion of `rd_kafka_message_t` to `KafkaAcknowledgementResult` to `RDKafkaConfig` so that we can pass the `KafkaAcknowledgementResult` type as early as possible and don't have to bother with `UnsafePointer<rd_kafka_message_t>` in all our delivery callback logic * expose KafkaProducer.run() method * `README`: use `TaskGroup` in `KafkaProducer` example * add comments to task groups in `README` * refactor all tests into using task groups (structured concurrency) Have two factory methods creating KafkaProducer Motivation: We want to have a `KafkaProducer` that is not consuming any acknowledgements. This means it is initialized without a `deliveryReportCallback` which in turn means that `librdkafka` will not queue any incoming acknowledgements which prevents us from running out of memory in that case. Modifications: * add two new factory methods for creating `KafkaProducer`: * `KafkaProducer.newProducer` * `KafkaProducer.newProducerWithAcknowledgements` * update README * Review Franz Modifications: * rename `KafkaProducer.newProducer*` to `KafkaProducer.makeProducer*` * update docc documentation for `KafkaProducer.newProducer*` methods * create new method `KafkaClient.poll(timeout:)` * KafkaProducer: AsyncStream + onTerminate->shutDown Motivation: Given that we don't support backpressure for our `KafkaProducer`, we can replace the `NIOAsyncSequence` with a `AsyncStream` for the acknowledgements. Furthermore we want to shut down the producer once our stream has terminated. Modifications: * `KafkaProducer`: replace `NIOAsyncSequence` with `AsyncStream` * `KafkaProducerTests.testNoMemoryLeakAfterShutdown` make sure to kill stream otherwise we have a memory leak
- Loading branch information
1 parent
27cf519
commit 840242c
Showing
9 changed files
with
479 additions
and
296 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.