1
我試圖通過控制總線啓動文件入站通道適配器,但我收到異常,而ExpressionCommandMessageProcessor試圖解析我的命令。如何通過控制總線啓動入站通道適配器?
這是我入站通道適配器配置:
@Bean(name = "inboundChannelAdapter")
public IntegrationFlow inputFilesReadingFlow()
{
return IntegrationFlows
.from(s -> s.file(new File(inputDirectory))
.filter(new AcceptAllFileListFilter<File>()),
e -> e.poller(Pollers.fixedDelay(FILE_POLLER_RATE))
.autoStartup(false)
)
.handle(messageProcessingService)
.channel(fileOutputChannel)
.get();
}
@Bean
public IntegrationFlow controlBusFlow()
{
return IntegrationFlows.from("controlBusChannel").controlBus().get();
}
在我的集成測試,我已經自動連接控制總線豆:
@Autowired
private MessageChannel controlBusChannel;
@Test
public void testInboundChannelAdapter()
{
controlBusChannel.send(new GenericMessage<String>("@'inboundChannelAdapter.<property_name_placeholder>'.start()")); // ????
// .....
}
所以我想問我怎麼可以訪問「適配器'bean(或任何負責啓動/停止操作的bean)啓動輪詢過程。
謝謝。
非常感謝回覆。我設法解決它使用特定的ID。另外我發現這個答案(http://stackoverflow.com/a/23916788/222002),同時等待我的問題的答覆和自動裝配SourcePollingChannelAdapter也爲我工作。 – Alex