【发布时间】:2017-08-01 14:16:15
【问题描述】:
使用Java配置如何启动/停止入站通道适配器,我尝试使用控制总线但我没有成功,请提供一个java配置示例。
【问题讨论】:
-
请提供一个示例,您到目前为止尝试过什么。控制总线和
stop()调用是正确的方式,但我们应该确保以任何方式在代码中。
标签: spring-integration spring-integration-sftp
使用Java配置如何启动/停止入站通道适配器,我尝试使用控制总线但我没有成功,请提供一个java配置示例。
【问题讨论】:
stop() 调用是正确的方式,但我们应该确保以任何方式在代码中。
标签: spring-integration spring-integration-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()"));
【讨论】: