Spring Cloud Streaming多个Kafka活页夹配置恢复为默认活页夹

时间:2018-06-20 19:40:34

标签: spring-cloud-stream spring-kafka

我有一个具有多个kafka活页夹配置的spring boot应用程序:

spring.cloud.stream:    
  bindings.publisher_input:
    destination: input_publisherUpdate
    group: dev
    binder: kafka2_binder

  bindings.publisher_output:
    destination: output_publisherUpdate
    producer.headerMode: raw
    binder: kafka1_binder

  binders:
    kafka1_binder:
      defaultCandidate: false
      type: kafka
      inheritEnvironment: false
      environment:
        spring.cloud.stream.kafka.binder:
          zkNodes: zk-b-1-vm:2181
          brokers: kafka-c2-01-vm:9092
        spring.cloud.stream.kafka.mode: raw
        spring.cloud.stream.default.consumer.headerMode: raw

   kafka2_binder:
      defaultCandidate: false
      type: kafka
      inheritEnvironment: false
      environment:
        spring.cloud.stream.kafka.binder:
          zkNodes: zk-stage-1:2181
          brokers: kafka-stage-1-broker:9092
        spring.cloud.stream.kafka.mode: raw
        spring.cloud.stream.default.consumer.headerMode: raw

如果我不包括defaultCandidate: false,它会抱怨找不到默认的资料夹。当我包含它时,出现以下错误-它似乎正在寻找一些默认的活页夹配置(localhost:2181) 关于我在这里缺少什么的任何想法?

018-06-20 12:20:07,570  INFO restartedMain-SendThread(localhost:2181) o.a.z.ClientCnxn:1032 - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-06-20 12:20:07,570  WARN restartedMain-SendThread(localhost:2181) o.a.z.ClientCnxn:1162 - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)

0 个答案:

没有答案