无法发送SSL关闭消息

时间:2018-01-26 01:35:17

标签: java apache-kafka kafka-consumer-api message-hub sslengine

我有一个线程,偶尔会在Message Hub上列出主题。但有一段时间,我得到一个:无法发送SSL关闭消息。

有什么想法吗?

KafkaConsumer<String, String> consumer = new KafkaConsumer<>(getConsumerConfiguration());
try {
    Map<String, List<PartitionInfo>> topics = consumer.listTopics();
    return new ArrayList<String>(topics.keySet());
} finally {
    if (consumer != null) {
        **consumer.close();**
    }
}

我收到来自 consumer.close 的警告。

消费者的配置:

  • sasl.mechanism = PLAIN
  • security.protocol = SASL_SSL
  • group.id = consumer1
  • ssl.enabled.protocol = TLSv1.2
  • ssl.endpoint.identification.algorithm = HTTPS
  • ssl.protocol = TLSv1.2
  • sasl.jaas.config = org.apache.kafka.common.security.plain.PlainLoginModule required username =“USERNAME”password =“PASSWORD”;
  

[WARN] 2018-01-25 20:12:23.204 [ClusterChannelMonitorTaskThread]   org.apache.kafka.common.network.SslTransportLayer {} - 无法发送   SSL关闭消息java.io.IOException:返回意外状态   SSLEngine.wrap,预计CLOSED,收到OK。不会发送关闭   消息给同行。在   org.apache.kafka.common.network.SslTransportLayer.close(SslTransportLayer.java:158)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.common.utils.Utils.closeAll(Utils.java:663)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.common.network.KafkaChannel.close(KafkaChannel.java:59)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.common.network.Selector.doClose(Selector.java:582)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.common.network.Selector.close(Selector.java:573)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.common.network.Selector.close(Selector.java:539)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.common.network.Selector.close(Selector.java:250)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.clients.NetworkClient.close(NetworkClient.java:505)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.close(ConsumerNetworkClient.java:439)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.clients.ClientUtils.closeQuietly(ClientUtils.java:71)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.clients.consumer.KafkaConsumer.close(KafkaConsumer.java:1613)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.clients.consumer.KafkaConsumer.close(KafkaConsumer.java:1573)   [kafka-clients-0.11.0.0.jar:?] at   org.apache.kafka.clients.consumer.KafkaConsumer.close(KafkaConsumer.java:1549)   [kafka-clients-0.11.0.0.jar:?] at   com.ibm.saas.msg.kafka.KafkaMessageService.listChannelNames(KafkaMessageService.java:305)   [萨斯MSG-卡夫卡TRUNK-SNAPSHOT.jar:TRUNK-快照]

2 个答案:

答案 0 :(得分:1)

今天也使用kafka客户端1.0.2命中此异常:/

答案 1 :(得分:0)

请确保您在/ etc / hosts中设置了正确的值 这是非常重要的。就我而言 listeners=SASL_SSL://10.10.10.3:9093 在server.properties文件中,所以我需要 10.10.10.3 SzymekKafka 在/ etc / hosts中,其中SzymekKafka是我的主机名。