wenxuanguan created KAFKA-8451: ---------------------------------- Summary: transaction support multiple producer instance Key: KAFKA-8451 URL: https://issues.apache.org/jira/browse/KAFKA-8451 Project: Kafka Issue Type: Bug Reporter: wenxuanguan
It's common in distributed system that multiple producer instances send message in one transaction concurrently, and if one producer failed, the other producer abort transaction. However, when multiple producer share the same txn id, throw the following exception: org.apache.kafka.common.KafkaException: Cannot execute transactional method because we are in an error state at org.apache.kafka.clients.producer.internals.TransactionManager.maybeFailWithError(TransactionManager.java:784) at org.apache.kafka.clients.producer.internals.TransactionManager.beginTransaction(TransactionManager.java:215) at org.apache.kafka.clients.producer.KafkaProducer.beginTransaction(KafkaProducer.java:606) at com.matt.test.kafka.producer.ProducerTransactionExample.main(ProducerTransactionExample.java:68) Caused by: org.apache.kafka.common.errors.ProducerFencedException: Producer attempted an operation with an old epoch. Either there is a newer producer with the same transactionalId, or the producer's transaction has been expired by the broker. -- This message was sent by Atlassian JIRA (v7.6.3#76005)