使用Kafka Producer发送数据时出现Timout异常

时间:2019-08-12 13:25:12

标签: java apache-kafka kafka-producer-api

在将数据生成到UAT环境时出现此错误:

org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for topic-2: 30808 ms has passed since batch creation plus linger time

在开发环境中,它运行良好,在UAT kafka日志中推送了数据,但是却花费了很多时间。

public ProducerFactory<String, Object> producerFactory() {
    Map<String, Object> config = new HashMap<>();
    config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,"ip:port");
    config.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, 
    StringSerializer.class);
    config.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, 
      StringSerializer.class);}

0 个答案:

没有答案
相关问题