0

I have been working on spring cloud sleuth to push traces to zipkin, We are pushing traces to Kafka with the help of spring-cloud-starter-stream-kafka and spring-cloud-sleuth-stream

Below are the dependencies I have added to my application

compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-sleuth', version: '1.0.0.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-sleuth-stream', version: '1.2.4.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-stream-kafka', version: '1.2.0.RELEASE'

And my application property just have kafka broker which is by default pushing traces to sleuth topic spring.cloud.stream.kafka.binder.brokers=locahost:9092

Everything is working fine as of now but I am not able to figure out if we can start the application if Kafka is down ?

From the logs I see application starts, but since it will be not able to connect to kafka we will be not able to access any of the endpoints (Added some bits of logs below). Looking for this solution because pushing traces is not the primary function of my application.

Started testApp in 0.299 seconds (JVM running for 20.241)
[WARN] 2019-12-19 13:27:56,183 main org.apache.kafka.clients.producer.ProducerConfig - {} - The configuration 'key.deserializer' was supplied but isn't a known config.
[WARN] 2019-12-19 13:27:56,183 main org.apache.kafka.clients.producer.ProducerConfig - {} - The configuration 'value.deserializer' was supplied but isn't a known config.
[INFO] 2019-12-19 13:27:56,184 main org.apache.kafka.common.utils.AppInfoParser - {} - Kafka version : 0.11.0.0
[INFO] 2019-12-19 13:27:56,184 main org.apache.kafka.common.utils.AppInfoParser - {} - Kafka commitId : cb8625948210849f
[WARN] 2019-12-19 13:27:56,225 kafka-producer-network-thread | producer-1 org.apache.kafka.clients.NetworkClient - {} - Connection to node -1 could not be established. Broker may not be available.
[WARN] 2019-12-19 13:27:56,335 kafka-producer-network-thread | producer-1 org.apache.kafka.clients.NetworkClient - {} - Connection to node -1 could not be established. Broker may not be available.
[WARN] 2019-12-19 13:27:56,390 kafka-producer-network-thread | producer-1 org.apache.kafka.clients.NetworkClient - {} - Connection to node -1 could not be established. Broker may not be available.
PRATHAP S
  • 675
  • 2
  • 8
  • 26

1 Answers1

1

Your versions are wrong. Please don't set the versions by yourself, please use the Spring Cloud BOM (spring-cloud-dependencies) dependency management like presented below

buildscript {
    dependencies {
        classpath "io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE"
    }
}

apply plugin: "io.spring.dependency-management"

dependencyManagement {
     imports {
          mavenBom "org.springframework.cloud:spring-cloud-sleuth:${springCloudSleuthVersion}"
     }
}
dependencies {
    compile 'org.springframework.cloud:spring-cloud-starter-sleuth'
}

Also - it's enough for you to add the starters. You've added a starter in a given version and then you've added the core dependency in another one, that makes no sense.

Last thing - versions 1.x are deprecated and no longer maintained. The current version is 2.2.0.RELEASE and release train version is Hoxton.RELEASE

Marcin Grzejszczak
  • 10,624
  • 1
  • 16
  • 32