I wonder if it's possible in spring integration to include an external channel in the flow. So I have http inbound gateway flow, and after it's triggered it should communicate with other process via udp ports. My biggest concern is how to receive a message from udp port inside this flow.
@Bean
public IntegrationFlow httpInboundGatewayFlow() {
return IntegrationFlows.from(Http.inboundGateway(httpInboundPath))
.transform(niUdpRequestTransformer())
/*sending a message to udp port*/
.publishSubscribeChannel(runnable -> runnable
.subscribe(flow -> flow
.handle(udpOutboundChannel())))
/*wait for input from udpResponse channel here (HOW TO?)*/
/*process udpInboundFlow message*/
.handle((payload, headers) -> successNetworkResponse())))
.transform(new ObjectToJsonTransformer())
.handle((payload, headers) -> payload)
.get();
}
@Bean
public IntegrationFlow udpInboundFlow() {
return IntegrationFlows.from(udpInboundChannel())
.transform(niUdpResponseTransformer())
.channel("udpResponse")
.get();
}
Using udpInboundFlow should be implemented as some kind of poller which checks if correct message has arrived.
Thanks for your help.