1
我嘗試創建一個從2個來源(1個mqtt和一個來自用戶服務交互)獲取消息的流程,並將消息生成到另一個mqtt。 事實上,我嘗試使用這樣的回答:How to crate Spring Integration Flow from two MessageProducerSpec?有兩個來源的彈簧整合流程
這裏是我的結果:
@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();
}
但我有以下錯誤:
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)