Spring Cloud Stream无法检测到消息路由器

时间:2018-02-14 19:11:07

标签: spring-cloud spring-cloud-stream

我正在尝试设置一个简单的云流Sink,但一直遇到以下错误。

我已经尝试过几种粘合剂,它们都会一直出现同样的错误。

pre_setlist = []

for song in pre_songs:
    if song.contains('>'):
        pre_setlist.append(song.split('>'))
    else:
        pre_setlist.append(song)

我正在尝试使用简单的Sink来记录来自kafka主题的传入消息

 "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.  

我的配置如下

@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);
    }

}    

和我的pom

# 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

1 个答案:

答案 0 :(得分:1)

TL; DR-检查您的Spring Boot版本并尝试对其进行一些次要修订。

从Spring Cloud DALSTON.RELEASE升级到Spring Cloud Edgware.SR4后,我在一个项目上遇到了这个问题-奇怪的是,其他项目运行良好,但是只有一个项目没有。

经过进一步调查,我发现麻烦制造者项目正在使用Spring Boot 1.5.3.RELEASE,而其他项目正在使用1.5.9.RELEASE

将Spring Boot升级到1.5.9.RELEASE后,一切似乎开始起作用