[ 
https://issues.apache.org/jira/browse/KAFKA-6076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jason Gustafson resolved KAFKA-6076.
------------------------------------
    Resolution: Duplicate

Marking as dup of KAFKA-6052 since it is likely the same underlying cause. We 
can reopen later if we find reason to think it's different.

> 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
> Client: kafka-clients 0.11.0.1
>            Reporter: Orwen Xiang
>            Priority: Major
>              Labels: windows
>
> 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
(v7.6.3#76005)

Reply via email to