The producer API doc (https://kafka.apache.org/23/javadoc/index.html?org/apache/kafka/clients/producer/KafkaProducer.html <https://kafka.apache.org/23/javadoc/index.html?org/apache/kafka/clients/producer/KafkaProducer.html>) says that KafkaProducer is thread safe.
What I was trying to figure out is what the relationship is between a thread context and a transaction initiated in that thread. When multiple threads are using a single producer instance and initiating transactions are those transaction boundaries scoped to the thread context, or do they step on each others’ toes? Suppose two threads are sharing the same producer instance the following way: thread-1 begins a transaction T1 thread-1 starts sending messages in T! thread-2 begins a transaction T2 thread-2 sends some messages in T2 thread-2 gets and error and rolls back its transaction T2 At this point does the rollback of transaction T2 by the thread-2 affect the transaction T1 remaining open and used by thread-1 in any fashion? It is not clear to me from the API documentation. Will very much appreciate some insights into the behavior here. Similar questions also arise for commits by threads independently of each other. Sincerely, Anindya Haldar Oracle Responsys