[
https://issues.apache.org/jira/browse/KAFKA-6153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Changhai Han updated KAFKA-6153:
--------------------------------
Description:
As mentioned in title, the kafka transaction messaging does not work on windows
but on linux.
The code is like below:
{code:java}
stringProducer.initTransactions();
while(true){
ConsumerRecords<String, String> records = stringConsumer.poll(2000);
if(!records.isEmpty()){
stringProducer.beginTransaction();
try{
for(ConsumerRecord record : records){
LOGGER.info(record.value().toString());
stringProducer.send(new ProducerRecord<String,
String>("kafka-test-out", record.value().toString()));
}
stringProducer.commitTransaction();
}catch (ProducerFencedException e){
LOGGER.warn(e.getMessage());
stringProducer.close();
stringConsumer.close();
}catch (KafkaException e){
LOGGER.warn(e.getMessage());
stringProducer.abortTransaction();
}
}
}
{code}
When I debug it, it seems to it stuck on committing the transaction. Does
anyone also experience the same thing? Is there any specific configs that i
need to add in the producer config? Thanks.
was:
As mentioned in title, the kafka transaction messaging does not work on windows
but on linux.
The code is like below:
stringProducer.initTransactions();
while(true){
ConsumerRecords<String, String> records = stringConsumer.poll(2000);
if(!records.isEmpty()){
stringProducer.beginTransaction();
try{
for(ConsumerRecord record : records){
LOGGER.info(record.value().toString());
stringProducer.send(new ProducerRecord<String,
String>("kafka-test-out", record.value().toString()));
}
stringProducer.commitTransaction();
}catch (ProducerFencedException e){
LOGGER.warn(e.getMessage());
stringProducer.close();
stringConsumer.close();
}catch (KafkaException e){
LOGGER.warn(e.getMessage());
stringProducer.abortTransaction();
}
}
}
When I debug it, it seems to it stuck on committing the transaction. Does
anyone also experience the same thing? Is there any specific configs that i
need to add in the producer config? Thanks.
> Kafka Transactional Messaging does not work on windows but on linux
> -------------------------------------------------------------------
>
> Key: KAFKA-6153
> URL: https://issues.apache.org/jira/browse/KAFKA-6153
> Project: Kafka
> Issue Type: Bug
> Components: consumer, producer
> Affects Versions: 0.11.0.1
> Reporter: Changhai Han
> Priority: Critical
>
> As mentioned in title, the kafka transaction messaging does not work on
> windows but on linux.
> The code is like below:
> {code:java}
> stringProducer.initTransactions();
> while(true){
> ConsumerRecords<String, String> records =
> stringConsumer.poll(2000);
> if(!records.isEmpty()){
> stringProducer.beginTransaction();
> try{
> for(ConsumerRecord record : records){
> LOGGER.info(record.value().toString());
> stringProducer.send(new ProducerRecord<String,
> String>("kafka-test-out", record.value().toString()));
> }
> stringProducer.commitTransaction();
> }catch (ProducerFencedException e){
> LOGGER.warn(e.getMessage());
> stringProducer.close();
> stringConsumer.close();
> }catch (KafkaException e){
> LOGGER.warn(e.getMessage());
> stringProducer.abortTransaction();
> }
> }
> }
> {code}
> When I debug it, it seems to it stuck on committing the transaction. Does
> anyone also experience the same thing? Is there any specific configs that i
> need to add in the producer config? Thanks.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)