spring-cloud-starter-bus-kafka setup on configserver

2.3k Views Asked by At

Dear Spring developers!

I would like to setup the spring cloud configserver from offical docs, and from sample codes. It works for me, and I would like to refresh my properties at runtime, if I change it github.

I already added the spring-cloud-config-monitor dependency as well, and I would like to use Kafka for change event broadcasting. I read it in docs, that it is possible, but I can't configure the configserver's spring-cloud-starter-bus-kafka and the clients's spring-cloud-starter-bus-kafka.

I also used a zookeeper, and kafka in docker, it works well.

Can anyone help me about how to configure kafka bus to configserver, and configclient?

Thanks

2

There are 2 best solutions below

2
On BEST ANSWER
spring:
  cloud:      
    bus:     
      enabled: true
    stream:
      kafka:
        binder:
          zkNodes: localhost:9092,127.0.0.1:9092
          brokers: localhost:2181,127.0.01:2181
0
On
spring:
  cloud:
    stream:
      kafka:
        binder:
          brokers: host1:port1,host2:port2
          zkNodes: host1:port1,host2:port2
          zkSessionTimeout: 6000

This worked for me. If you want to configure external Kafka brokers then the config should be by default convention of spring cloud kafka connector.