Reputation: 11818
What would be the Spring Integration DSL way of creating the equivalent of
<int:gateway service-interface="MyService" default-request-channel="myService.inputChannel"/>
// where my existing interface looks like
interface MyService { process(Foo foo); }
I've not been able to find a factory in org.springframework.integration.dsl
and none of argument lists for IntegrationFlows.from(...)
are helping self discovery.
It sort of feels like I'm missing something like a Java
protocol adaptor from https://github.com/spring-projects/spring-integration-java-dsl/wiki/Spring-Integration-Java-DSL-Reference#using-protocol-adapters.
// I imagine this is what I can't find
IntegrationFlows.from(Java.gateway(MyService.class)
.channel("myService.inputChannel")
.get();
The only thing I've come across is on an old blog post, but it seems to require annotating the interface with @MessagingGateway
and @Gateway
, which I'd like to avoid. See https://spring.io/blog/2014/11/25/spring-integration-java-dsl-line-by-line-tutorial
Upvotes: 1
Views: 2261
Reputation: 121442
We have done that recently in Spring Integration 5.0. With that you really can do this:
@Bean
public IntegrationFlow controlBusFlow() {
return IntegrationFlows.from(ControlBusGateway.class)
.controlBus()
.get();
}
public interface ControlBusGateway {
void send(String command);
}
See more info in the latest blog post.
Right now you don't have choice unless declare @MessagingGateway
on the interface and start the flow from the request channel for that gateway definition.
Upvotes: 4