Is there a way to stop the inbound channel adapter after files are received from sftp server using java configuration

ぃ、小莉子 提交于 2019-12-11 04:29:35

问题


Using Java Configuration how to start/stop the Inbound Channel adapter,I tried using control bus But i wasn't sucessful ,Please provide an example with java configuration .


回答1:


The @InboundChannelAdapter populates SourcePollingChannelAdapter bean with the name based on the pattern [configurationComponentName].[methodName].[decapitalizedAnnotationClassShortName]. For example:

@Configuration
@EnableIntegration
public class MyConfiguration {

    @InboundChannelAdapter(channel = "inputChannel")
    @Bean
    public MessageSource<String> myMessageSource() {
        return () -> new GenericMessage<>("bar");
    }

}

will have a bean name as myConfiguration.myMessageSource.inboundChannelAdapter.

The SourcePollingChannelAdapter is indeed Lifecycle and can be managed by the Control Bus:

controlBusChannel.send(
      new GenericMessage("@'myConfiguration.myMessageSource.inboundChannelAdapter'.stop()"));


来源:https://stackoverflow.com/questions/45440330/is-there-a-way-to-stop-the-inbound-channel-adapter-after-files-are-received-from

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!