kafka-jira mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Orwen Xiang (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KAFKA-6076) Using new producer api of transaction twice failed when server run on Windows OS
Date Wed, 18 Oct 2017 03:41:00 GMT
Orwen Xiang created KAFKA-6076:
----------------------------------

             Summary: Using new producer api of transaction twice failed when server run on
Windows OS
                 Key: KAFKA-6076
                 URL: https://issues.apache.org/jira/browse/KAFKA-6076
             Project: Kafka
          Issue Type: Bug
          Components: core
    Affects Versions: 0.11.0.1
         Environment: OS: Windows 10 64bit
Kafka:  kafka_2.11-0.11.0.1(https://www.apache.org/dyn/closer.cgi?path=/kafka/0.11.0.1/kafka_2.11-0.11.0.1.tgz)
JDK: 1.8.0_144  64bit
            Reporter: Orwen Xiang


Can't invoke twice (begin,commit transaction) on same Kafka Producer instance  when it connected
Kafka server run on windows 10.

But same code can run successfully when Kafka server run on CentOS 7.3 64bit with same Kafka
server code base and config.

Producer code looks like:
Map<String, Object> props = new HashMap<>();
props.put("bootstrap.servers", "localhost:9092");
props.put("transactional.id", "my-transactional-id");
Producer<String, String> producer = new KafkaProducer<>(props, new StringSerializer(),
new StringSerializer());
producer.initTransactions();
try {
     producer.beginTransaction();
     for (int i = 0; i < 100; i++)
        producer.send(new ProducerRecord<>("test-2", Integer.toString(i), Integer.toString(i)));
     producer.commitTransaction();
     System.out.println("sent one time done");
     producer.beginTransaction();
     for (int i = 0; i < 100; i++)
        producer.send(new ProducerRecord<>("test-2", Integer.toString(i), Integer.toString(i)));
      producer.commitTransaction();
      System.out.println("sent two time done");
      } catch (ProducerFencedException | OutOfOrderSequenceException | AuthorizationException
e) {
           producer.close();
      } catch (KafkaException e) {
           producer.abortTransaction();
        }
      producer.close();



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message