0

我正在开发 SpringCloudStream 的 Brooklyn.Release 版本。我的用例有多个接收器的 HttpSource。当我将 Starter App 依赖项添加到应用程序并使用它时,如下所示:

<dependency>
                <groupId>org.springframework.cloud.stream.app</groupId>
                <artifactId>spring-cloud-starter-stream-source-http</artifactId>
                <version>1.0.4.RELEASE</version>
</dependency>

@SpringBootApplication
@Import(HttpSourceConfiguration.class)
public class SourceApplication {
    public static void main(String[] args) {
        SpringApplication.run(SourceApplication.class, args);
    }
}

我的聚合应用程序是

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        new AggregateApplicationBuilder().from(SourceApplication.class)
                .via(ProcessorApplication.class).to(SinkApplication.class).args().run(args);
    }
}

一直得到以下响应:

<Fault xmlns="http://localhost/">
   <error>Not Found</error>
   <message>No message available</message>
   <path>/</path>
   <status>404</status>
   <timestamp>1477612242743</timestamp>
</Fault>

为 HttpSourceConfiguration(开箱即用)添加了 ComponentScan;但没有成功。

@SpringBootApplication
@ComponentScan(value = {"com.xxx.xxx.stream","org.springframework.cloud.stream.app.http.source"})
public class Application {
    public static void main(String[] args) {
        new AggregateApplicationBuilder().from(SourceApplication.class)
                .via(ProcessorApplication.class).to(SinkApplication.class).args().run(args);
    }
}

如果我将相同的 SourceApplication 与 Rabbit Binder 一起使用,它会按预期工作。你能指导我完成这项工作吗?

感谢您的帮助和时间。

问候卡提克

4

1 回答 1

0

似乎没有设置 REST 端点,看起来您可能遇到了这个问题。您将需要@ComponentScan位于 where 的包HttpSourceConfiguration(因为它来自不同的包)。

如果我将相同的 SourceApplication 与 Rabbit Binder 一起使用,它会按预期工作。

http您是指带有兔子活页夹的开箱即用应用程序,还是您只是rabbit在上面添加了活页夹依赖项SourceApplication

通常您更喜欢使用http开箱即用的源应用程序(带有任何关联的绑定器),但对于聚合应用程序,您不需要绑定器,除非您拥有inputoutput聚合应用程序本身绑定到代理。

于 2016-10-31T04:27:28.587 回答