spring-cloud-stream-binder-aws-kinesi不能使用@Output

时间:2017-12-01 05:13:57

标签: amazon-kinesis spring-cloud-stream

首先,我必须描述我的问题和我所做的事情。 由于我选择了aws云服务,因此kinesis服务是我的首选。 因此,构建我的应用程序需要spring-cloud-stream-binder-aws-kinesis组件。

这是频道界面:

public interface KinesisChannel {
  String StockTradeStream = "StockTradeStream";
  String CHANNEL_SECOND = "channel_second";


  @Input(KinesisChannel.StockTradeStream)
  SubscribableChannel in_channel_a();

  @Input(KinesisChannel.CHANNEL_SECOND)
  SubscribableChannel in_channel_second();

//    @Output(KinesisChannel.CHANNEL_SECOND)
//    MessageChannel out_channel_second();

}

这是为了简化消息并在将消息发送到另一个频道后给出回复。

@EnableRxJavaProcessor()
class App2{
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private MessageChannel StockTradeStream;

    @Bean
    public RxJavaProcessor<Object,Object> processor(){
        return inputStream -> inputStream.map(data->{
            logger.info("Received message:"+data);
            if(data!=null){
                StockTradeStream.send(MessageBuilder.withPayload("send a StockTradeStream message!").build());
            }
            return data;
        }).buffer(5).map(data -> String.valueOf("From Output Channel Return -"+ data));
    }
}

当我启动我的应用程序时,出现异常:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-12-01 11:31:22.288 ERROR 37048 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.AbstractMethodError: org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.createProducerMessageHandler(Lorg/springframework/cloud/stream/provisioning/ProducerDestination;Lorg/springframework/cloud/stream/binder/ProducerProperties;)Lorg/springframework/messaging/MessageHandler;
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:50) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:348) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:151) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:114) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:880) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at com.bind.ApplicationStarter.main(ApplicationStarter.java:13) [classes/:na]
Caused by: java.lang.AbstractMethodError: org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.createProducerMessageHandler(Lorg/springframework/cloud/stream/provisioning/ProducerDestination;Lorg/springframework/cloud/stream/binder/ProducerProperties;)Lorg/springframework/messaging/MessageHandler;
at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:112) ~[spring-cloud-stream-1.2.2.RELEASE.jar:1.2.2.RELEASE]
at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:57) ~[spring-cloud-stream-1.2.2.RELEASE.jar:1.2.2.RELEASE]
at org.springframework.cloud.stream.binder.AbstractBinder.bindProducer(AbstractBinder.java:152) ~[spring-cloud-stream-1.2.2.RELEASE.jar:1.2.2.RELEASE]
at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:124) ~[spring-cloud-stream-1.2.2.RELEASE.jar:1.2.2.RELEASE]
at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:238) ~[spring-cloud-stream-1.2.2.RELEASE.jar:1.2.2.RELEASE]
at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:57) ~[spring-cloud-stream-1.2.2.RELEASE.jar:1.2.2.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
... 14 common frames omitted

经过多次尝试,我发现输出通道不能与@ Output绑定,但是通过这种方式发送消息是正常的:

        StockTradeStream.send(MessageBuilder.withPayload("send a StockTradeStream message!").build());

如果我用兔子/ kafka替换kinesis,匹配的流绑定器,这是由docker local.output通道可以与@Output一起使用

那么问题是什么,我是否想念导致这个问题的事情?

1 个答案:

答案 0 :(得分:0)

  

引起:java.lang.AbstractMethodError:org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.createProducerMessageHandler(Lorg / springframework / cloud / stream / provisioning / ProducerDestination; Lorg / springframework / cloud / stream / binder / ProducerProperties; )Lorg / springframework的/消息/的MessageHandler;

看起来您正在尝试将其与错误版本的Spring Cloud Stream一起使用。它需要1.3.x. - 见the pom