Matthew Acton
Matthew Acton

Reputation: 31

Spring Cloud Stream unable to detect message router

I'm trying to set up a simple cloud stream Sink but keep running into the following errors.

I've tried several binders and they all keep giving the same error.

 "SEVERE","logNameSource":"org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter","message":"
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method binderAwareRouterBeanPostProcessor in org.springframework.cloud.stream.config.BindingServiceConfiguration required a bean of type '[ Lorg.springframework.integration.router.AbstractMappingMessageRouter;' that could not be found.
Action:
Consider defining a bean of type '[ Lorg.springframework.integration.router.AbstractMappingMessageRouter;' in your configuration.  

I'm trying to use a simple Sink to log an incoming message from a kafka topic

@EnableBinding(Sink.class)
public class ReadEMPMesage {
    private static Logger logger = 
    LoggerFactory.getLogger(ReadEMPMesage.class);

    public ReadEMPMesage() {
        System.out.println("In constructor");
    }


    @StreamListener(Sink.INPUT)
    public void loggerSink(String ccpEvent) {
        logger.info("Received" + ccpEvent);
    }

}    

and my configuration is as follows

# Test consumer properties
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.group-id=testEmbeddedKafkaApplication
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.ByteArrayDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.ByteArrayDeserializer

# Binding properties
spring.cloud.stream.bindings.output.destination=testEmbeddedOut
spring.cloud.stream.bindings.input.destination=testEmbeddedIn
spring.cloud.stream.bindings.output.producer.headerMode=raw
spring.cloud.stream.bindings.input.consumer.headerMode=raw
spring.cloud.stream.bindings.input.group=embeddedKafkaApplication

and my pom

    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-stream-kafka</artifactId>
    </dependency>



   <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream</artifactId>
    </dependency>

Upvotes: 3

Views: 1031

Answers (1)

cwash
cwash

Reputation: 4245

TL;DR - check your version of Spring Boot and try upgrading it a few minor revs.

I ran into this problem on a project after upgrading from Spring Cloud DALSTON.RELEASE to Spring Cloud Edgware.SR4 -- it was strange because other projects worked fine but there was a single one that didn't.

After further investigation I realized that the troublemaker project was using Spring Boot 1.5.3.RELEASE and others were using 1.5.9.RELEASE

After upgrading Spring Boot to 1.5.9.RELEASE things seemed to start working

Upvotes: 1

Related Questions