Spring集成DSL创建等效于
<int:gateway service-interface="MyService" default-request-channel="myService.inputChannel"/> // where my existing interface looks like interface MyService { process(Foo foo); }
org.springframework.integration.dsl 没有参数列表 IntegrationFlows.from(...) 帮助自我发现。
org.springframework.integration.dsl
IntegrationFlows.from(...)
Java 来自的协议适配器 https://github.com/spring-projects/spring-integration-java-dsl/wiki/Spring-Integration-Java-DSL-Reference#using-protocol-adapters
Java
// I imagine this is what I can't find IntegrationFlows.from(Java.gateway(MyService.class) .channel("myService.inputChannel") .get();
我遇到的唯一一件事是在一篇旧的博客文章中,但它似乎需要用 @MessagingGateway 和 @Gateway https://spring.io/blog/2014/11/25/spring-integration-java-dsl-line-by-line-tutorial
@MessagingGateway
@Gateway
我们最近在Spring Integration 5.0中已经做到了这一点。有了它,您真的可以做到:
@Bean public IntegrationFlow controlBusFlow() { return IntegrationFlows.from(ControlBusGateway.class) .controlBus() .get(); } public interface ControlBusGateway { void send(String command); }
blog post .
现在你没有选择,除非申报 @MessagingGateway 并从该网关定义的请求通道启动流。