有没有一种方法可以在使用java配置从sftp服务器接收文件后停止入站通道适配器
答
@InboundChannelAdapter
使用基于模式[configurationComponentName].[methodName].[decapitalizedAnnotationClassShortName]
的名称填充SourcePollingChannelAdapter
bean。例如:
@Configuration
@EnableIntegration
public class MyConfiguration {
@InboundChannelAdapter(channel = "inputChannel")
@Bean
public MessageSource<String> myMessageSource() {
return() -> new GenericMessage<>("bar");
}
}
将有一个bean的名称作为myConfiguration.myMessageSource.inboundChannelAdapter
。
的SourcePollingChannelAdapter
确实Lifecycle
,并且可以通过控制总线进行管理:
controlBusChannel.send(
new GenericMessage("@'myConfiguration.myMessageSource.inboundChannelAdapter'.stop()"));
+0
非常感谢你Artem ..得到它并实施... – user2573586
+0
听起来不错!现在考虑一下:https://stackoverflow.com/help/someone-answers –
请提供你尝试过什么到目前为止的例子。控制总线和'stop()'调用是正确的方式,但我们应该确定任何方式的代码。 –