Kafka订阅者客户端0.10.2 - Spring Integration - INVALID_TOPIC_EXCEPTION

时间:2017-10-26 12:06:29

标签: java apache-kafka

我正在尝试使用Spring集成订阅Kafka服务器。我能够在应用程序日志中看到kafka connect登录。鉴于以下相同。

如果我在这里缺少任何必要的配置,请告诉我。

16:56:02.959 [main] INFO org.apache.kafka.clients.consumer.ConsumerConfig 

    ConsumerConfig values: 
    auto.commit.interval.ms = 100
    auto.offset.reset = latest
    bootstrap.servers = [10.176.138.40:9092, 10.176.138.208:9092, 
         10.176.138.169:9092, 10.176.138.184:9092, 10.176.138.188:9092]
    check.crcs = true
    client.id = 
    connections.max.idle.ms = 540000
    enable.auto.commit = true
    exclude.internal.topics = true
    fetch.max.bytes = 52428800
    fetch.max.wait.ms = 500
    fetch.min.bytes = 1
    group.id = amqunpnotifyd-dev-thilak
    heartbeat.interval.ms = 1000
    interceptor.classes = null
    key.deserializer = class 
    org.apache.kafka.common.serialization.StringDeserializer
    max.partition.fetch.bytes = 1048576
    max.poll.interval.ms = 300000
    max.poll.records = 500
    metadata.max.age.ms = 300000
    metric.reporters = []
    metrics.num.samples = 2
    metrics.recording.level = INFO
    metrics.sample.window.ms = 30000
    partition.assignment.strategy = [class 
    org.apache.kafka.clients.consumer.RangeAssignor]
    receive.buffer.bytes = 65536
    reconnect.backoff.ms = 5000
    request.timeout.ms = 305000
    retry.backoff.ms = 100
    sasl.jaas.config = null
    sasl.kerberos.kinit.cmd = /usr/bin/kinit
    sasl.kerberos.min.time.before.relogin = 60000
    sasl.kerberos.service.name = null
    sasl.kerberos.ticket.renew.jitter = 0.05
    sasl.kerberos.ticket.renew.window.factor = 0.8
    sasl.mechanism = GSSAPI
    security.protocol = PLAINTEXT
    send.buffer.bytes = 131072
    session.timeout.ms = 10000
    ssl.cipher.suites = null
    ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
    ssl.endpoint.identification.algorithm = null
    ssl.key.password = null
    ssl.keymanager.algorithm = SunX509
    ssl.keystore.location = null
    ssl.keystore.password = null
    ssl.keystore.type = JKS
    ssl.protocol = TLS
    ssl.provider = null
    ssl.secure.random.implementation = null
    ssl.trustmanager.algorithm = PKIX
    ssl.truststore.location = null
    ssl.truststore.password = null
    ssl.truststore.type = JKS
    value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer


16:56:02.967 [main] INFO org.apache.kafka.clients.consumer.ConsumerConfig ConsumerConfig values: 
    auto.commit.interval.ms = 100
    auto.offset.reset = latest
    bootstrap.servers = [10.176.138.40:9092, 10.176.138.208:9092, 
      10.176.138.169:9092, 10.176.138.184:9092, 10.176.138.188:9092]
    check.crcs = true
    client.id = consumer-1
    connections.max.idle.ms = 540000
    enable.auto.commit = true
    exclude.internal.topics = true
    fetch.max.bytes = 52428800
    fetch.max.wait.ms = 500
    fetch.min.bytes = 1
    group.id = amqunpnotifyd-dev-thilak
    heartbeat.interval.ms = 1000
    interceptor.classes = null
    key.deserializer = class 
    org.apache.kafka.common.serialization.StringDeserializer
    max.partition.fetch.bytes = 1048576
    max.poll.interval.ms = 300000
    max.poll.records = 500
    metadata.max.age.ms = 300000
    metric.reporters = []
    metrics.num.samples = 2
    metrics.recording.level = INFO
    metrics.sample.window.ms = 30000
    partition.assignment.strategy = [class 
    org.apache.kafka.clients.consumer.RangeAssignor]
    receive.buffer.bytes = 65536
    reconnect.backoff.ms = 5000
    request.timeout.ms = 305000
    retry.backoff.ms = 100
    sasl.jaas.config = null
    sasl.kerberos.kinit.cmd = /usr/bin/kinit
    sasl.kerberos.min.time.before.relogin = 60000
    sasl.kerberos.service.name = null
    sasl.kerberos.ticket.renew.jitter = 0.05
    sasl.kerberos.ticket.renew.window.factor = 0.8
    sasl.mechanism = GSSAPI
    security.protocol = PLAINTEXT
    send.buffer.bytes = 131072
    session.timeout.ms = 10000
    ssl.cipher.suites = null
    ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
    ssl.endpoint.identification.algorithm = null
    ssl.key.password = null
    ssl.keymanager.algorithm = SunX509
    ssl.keystore.location = null
    ssl.keystore.password = null
    ssl.keystore.type = JKS
    ssl.protocol = TLS
    ssl.provider = null
    ssl.secure.random.implementation = null
    ssl.trustmanager.algorithm = PKIX
    ssl.truststore.location = null
    ssl.truststore.password = null
    ssl.truststore.type = JKS
    value.deserializer = class 
    org.apache.kafka.common.serialization.StringDeserializer

即使主题存在,我也会在记录器中关注警告。

WARN org.apache.kafka.clients.NetworkClient Error while fetching metadata with correlation id 3 : {"notification.email.click"=INVALID_TOPIC_EXCEPTION}

由于哪个主题未分配给我的消费者群组。

2 个答案:

答案 0 :(得分:0)

根据文档所述,当 “客户端试图对无效主题执行操作。”

通常在客户端由于多种原因而无法发布时发生

  • 未创建主题。
  • 客户端和kafka服务器之间的防火墙配置。

由于您的情况,您的配置未知。您可以从调试上述原因开始。

答案 1 :(得分:0)

您的主题名称为"notification.email.click"(包括引号)。 双引号(")不是主题名称的合法字符。

根据Kafka文档,主题命名的合法字符包括:

  1. ASCII字母数字
  2. .
  3. _
  4. -

source code for 0.10.2定义了以下合法字符:

val legalChars = "[a-zA-Z0-9\\._\\-]"
private val maxNameLength = 249
private val rgx = new Regex(legalChars + "+")