2017-06-10 5 views
1

私はクラウドストリームを開始していますが、この2日間でこの問題が発生しているようです。しようとした別のバージョンはstackoverflowの周りを見たが、私はこの作業を得ることができません。SpringCloudStream 1.2.2 AggregateApplicationBuilderはバインダーを期待しています

はここにここに私のすべてのプロセッサは、以下の形式

@SpringBootApplication 
@EnableBinding(Processor.class) 
public class ProcessorApplicationXXX { 

@Transformer(inputChannel = "input", outputChannel = "output") 
public String transform(String payload) { 

} 
} 

である私のアグリゲータ

new AggregateApplicationBuilder(AggregateConfig.class) 
    .from(JSONFileSourceApplication.class).args("--fixedDelay=10000") 
    .via(ProcessorApplicationOne.class) 
    .via(ProcessorApplicationTwo.class) 
    .via(ProcessorApplicationThree.class) 
    .to(LoggingSinkApplication.class).run(args); 

ここに私のSourceApplicationがある私の設定

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.5.4.RELEASE</version> 
</parent> 

<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-dependencies</artifactId> 
      <version>Dalston.SR1</version> 
      <type>pom</type> 
      <scope>import</scope> 
     </dependency>   
    </dependencies> 
</dependencyManagement> 

です。

@SpringBootApplication 
@EnableBinding(Source.class) 
public class JSONFileSourceApplication { 

@Bean 
@InboundChannelAdapter(Source.OUTPUT) 
public String greet() throws IOException { 
    File file = new File("input_event.json"); 
    FileInputStream fis = new FileInputStream(file); 
    final String jsonRequest = IOUtils.toString(fis); 
    return jsonRequest; 
} 

}

Iソース法@Bean注釈を付ける場合は、例外下にスロー。リファレンスドキュメントの例には@Beanアノテーションが付けられています。私が何が欠けているか分からない。

Caused by: java.lang.IllegalArgumentException: The 'interface org.springframework.integration.annotation.InboundChannelAdapter' on @Bean method level is allowed only for: org.springframework.integration.core.MessageSourcebeans: java.lang.String 
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:389) 
at org.springframework.util.Assert.isInstanceOf(Assert.java:327) 
at org.springframework.integration.config.annotation.InboundChannelAdapterAnnotationPostProcessor.createMessageSource(InboundChannelAdapterAnnotationPostProcessor.java:85) 
at org.springframework.integration.config.annotation.InboundChannelAdapterAnnotationPostProcessor.postProcess(InboundChannelAdapterAnnotationPostProcessor.java:63) 
at org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor$1.doWith(MessagingAnnotationPostProcessor.java:189) 
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:530) 
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:537) 
at org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor.postProcessAfterInitialization(MessagingAnnotationPostProcessor.java:155) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1633) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) 
... 17 common frames omitted 

@Beanを離した場合、例外は発生しません。

2017-06-09 19:47:24 [main] ERROR o.s.boot.SpringApplication - 
Application startup failed 
org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalStateException: A default binder has been requested, but there there is no binder available 
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176) 
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) 
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346) 
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149) 
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) 
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:879) 
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) 
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) 
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) 
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) 
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) 
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) 
at org.springframework.cloud.stream.aggregate.AggregateApplicationUtils.createParentContext(AggregateApplicationUtils.java:52) 
at org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder.run(AggregateApplicationBuilder.java:207) 
at org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder$AppConfigurer.run(AggregateApplicationBuilder.java:412) 
at com.xdmodules.aggregate.SampleAggregateApplication.main(SampleAggregateApplication.java:30) 
Caused by: java.lang.IllegalStateException: A default binder has been requested, but there there is no binder available 
at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:95) 
at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:155) 
at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:111) 
at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:238) 
at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:57) 
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173) 
... 16 common frames omitted 

私にこれを手伝ってください。

更新: 私はすべてのビジネスロジック/依存関係を取り除き、最低限のアプリケーションを作成しました。私は間違いを見るのをやめた。 Source-> Processor-> Sinkがある場合、アプリケーションは完璧に動作します。しかし、1つ以上のプロセッサがある場合、出力は期待通りではありません。チャンネル設定が間違っているか、この問題に関連している可能性があります - https://github.com/spring-cloud/spring-cloud-dataflow/issues/1519

ここに私のサンプルコードへのリンクがあります。 https://github.com/kkirankulkarni/PlainAggregateApplication

答えて

0

戻り値の型がMessageSourceでない限り@Bean注釈は、メソッドに存在すべきではない - これはドキュメントのミスです - https://github.com/spring-cloud/spring-cloud-stream/issues/987を参照してください。

これが失敗していて、例の一部(例:シンク)が欠落していることがわかりません。完全な例をGitHubに含めることは可能でしょうか?

あなたもこの作業例を見てとることができます。

https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/doubleは、一般的に、問題の診断に役立つはず利用できるあなたの完全なプロジェクトを持つ、話します。

+0

エラーが表示されなくなりました。 Source-> Processor-> Sinkがある場合、アプリケーションは完璧に動作します。しかし、1つ以上のプロセッサがある場合、出力は期待通りではありません。私のチャンネル構成が間違っているか、この問題に関連している可能性があります - https://github.com/spring-cloud/spring-cloud-dataflow/issues/1519 ここに私のサンプルコードへのリンクがあります。 https://github.com/kkirankulkarni/PlainAggregateApplication – Kiran

+0

'@ SpringBootApplication'を使用している場合は、各プロセッサ/アプリケーションを別々のパッケージに設定する必要があります。そうしないと、クラスパススキャンによって干渉することになります。 http://docs.spring.io/autorepo/docs/spring-cloud-stream-docs/Chelsea.SR2/reference/htmlsingle/#_aggregationの注記を参照してください。 –

関連する問題