From 53d548b9870a92c012796654d1b9a63362af3a2d Mon Sep 17 00:00:00 2001 From: janstenpickle Date: Tue, 8 Mar 2022 11:17:04 +0000 Subject: [PATCH] Update transactional producer docs Adds note on concurrent access performance constraints --- docs/src/main/mdoc/transactions.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/src/main/mdoc/transactions.md b/docs/src/main/mdoc/transactions.md index 8163a5057..448dd062b 100644 --- a/docs/src/main/mdoc/transactions.md +++ b/docs/src/main/mdoc/transactions.md @@ -13,6 +13,11 @@ Kafka transactions are supported through a [`TransactionalKafkaProducer`][transa - Create `CommittableProducerRecords` and wrap them in `TransactionalProducerRecords`. +> Note that calls to `produce` are sequenced in the `TransactionalKafkaProducer` to ensure that, when used concurrently, transactions don't run into each other resulting in an invalid transaction transition exception. +> +> Because the `TransactionalKafkaProducer` waits for the record batch to be flushed and the transaction committed on the broker, this could lead to performance bottlenecks where a single producer is shared among many threads. +> To ensure the performance of `TransactionalKafkaProducer` aligns with your performance expectations when used concurrently, it is recommended you create a pool of transactional producers. + Following is an example where transactions are used to consume, process, produce, and commit. ```scala mdoc