0

enter image description here

Micro service 1:

artefact id - microservice1 Defined KafkaStreams.java interface where in defined the binder properties like below.

public interface KafkaStreams {

    String OUTPUT = "kafka-output";

    String INPUT = "kafka-input";

    @Input(INPUT)
    SubscribableChannel getInputChannel();

    @Output(OUTPUT)
    MessageChannel getOutboundMessageChannel();
}

Micro service 2: artefact id - microservice2

In the micro service2 added dependency microservice1 and gave the cloud properties broker conf and topic names.

spring:
  application:
    name: business-service
  cloud:
    stream:
      default-binder: kafka1
      function:
        definition: 
      kafka:
        binder:
          brokers:
            - localhost:9092
          configuration:
            default.key.serde: org.apache.kafka.common.serialization.Serdes$StringSerde
            default.value.serde: org.apache.kafka.common.serialization.Serdes$BytesSerde
            commit.interval.ms: 1000
            security.protocol: SASL_PLAINTEXT      
      bindings:
        kafka-input:
          destination: topic1
          contentType: text/plain
          binder: kafka1
        kafka-output:
          destination: topic2
          contentType: text/plain
          binder: kafka1      
      binders:
        kafka1:
         type: kafka
         environment:
           spring:
             cloud:
               stream:
                kafka:
                  binder:
                    brokers: localhost:9092

Stack trace :

2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeMessageChannelConfigurer' defined in org.springframework.cloud.stream.config.BinderFactoryAutoConfiguration: Unsatisfied dependency expressed through method 'compositeMessageChannelConfigurer' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.stream.binding.MessageConverterConfigurer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-03-25T15:21:09.748+08:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]

sbogadhi
  • 31
  • 1
  • 3
  • Can you actually explain what you are trying to accomplish? What version of spring-cloud-stream you are using? Post sample code for your application? Post full stack trace? Your configuration yaml is confusing and contains incomplete fragments, redundant fragments etc. It is hard to understand. Best thing you can do is post your application on GitHub so one of us can take a look – Oleg Zhurakousky Mar 25 '20 at 07:58
  • @OlegZhurakousky As shown attached image, have service1 which am using a library. In all the services am trying to inject service1 library and configure diff topics and kafka clusters in all the other services. – sbogadhi Mar 25 '20 at 08:13
  • Thank you @OlegZhurakousky. Fixed Cloud stream YML configuration and working fine. – sbogadhi Mar 26 '20 at 02:11

0 Answers0