I try to create a flow which get message from 2 sources (1 mqtt and one from a user service interaction) and it generate message to another mqtt. In fact, i try to use this answer: How to crate Spring Integration Flow from two MessageProducerSpec?
And here is my result:
@Bean
public IntegrationFlow mqttInFlow() {
return IntegrationFlows.from(mqttInbound())
.channel("mainMessageChannel")
.get();
}
@Bean
public IntegrationFlow mqttTestMessageFlow() {
return IntegrationFlows.from(messageService.testInbound())
.channel("mainMessageChannel")
.get();
}
@Bean
public IntegrationFlow mainMessageFlow() {
return IntegrationFlows.from("mainMessageChannel")
.handle(eventServiceHandler())
.split(operationSplitter())
.handle(mqttOutbound())
.get();
}
But i have the following error:
java.lang.IllegalStateException: 'outputChannel' or 'outputChannelName' is required
at org.springframework.util.Assert.state(Assert.java:70)
at org.springframework.integration.endpoint.MessageProducerSupport.afterSingletonsInstantiated(MessageProducerSupport.java:136)