如何在处理文件时停止spring集成中的轮询器

如何在处理文件时停止spring集成中的轮询器,spring,spring-integration,Spring,Spring Integration,在这里,当执行耗时的过程时,我不想轮询SFTP入站通道适配器。完成耗时过程后,轮询器应自动启动 有没有办法做到这一点?有什么方法可以实现它吗?使用executor服务的目的是什么-让流在轮询器线程上运行,直到当前轮询完成,下一次轮询才会发生。看起来,在上使用固定延迟而不是固定速率,并在TaskScheduler线程中执行任务就足够了。在这种情况下,一次只有一个进程。下一个将在上一个完成后开始。实际需求来自sftp我必须一次复制多个文件,并且我必须使用spring批处理逐个处理文件。您能详细说明我

在这里,当执行耗时的过程时,我不想轮询SFTP入站通道适配器。完成耗时过程后,轮询器应自动启动


有没有办法做到这一点?有什么方法可以实现它吗?

使用executor服务的目的是什么-让流在轮询器线程上运行,直到当前轮询完成,下一次轮询才会发生。

看起来,在上使用固定延迟而不是固定速率,并在TaskScheduler线程中执行任务就足够了。在这种情况下,一次只有一个进程。下一个将在上一个完成后开始。

实际需求来自sftp我必须一次复制多个文件,并且我必须使用spring批处理逐个处理文件。您能详细说明我如何在轮询线程中运行它吗?嘿,您能解释一下我们如何访问轮询线程吗?你能指导我运行这个吗?你说的访问是什么意思?您可以随意停止/启动适配器。您可以在上一个任务完成后重新启动适配器-框架无法为您执行此操作。好的。您可以解释在收到文件时如何停止适配器,以及在文件处理完成后如何重新启动适配器吗?使用和发送@ftpInBound.stop和…start。对于1分钟延迟alloc.delay=60000,我不是要这个配置。我要的是完整的配置。这个轮询器配置我已经在问题中提到过了。
<bean id="inFileHandler"
    class="com.yahoo.FileProcessHandler" />

<bean id="executorService" class="java.util.concurrent.Executors" factory-method="newSingleThreadExecutor" destroy-method="shutdownNow" />

<int:channel id="inChannel" />

<int:channel id="outChannel">
    <int:queue capacity="5" />
</int:channel>

<bean id="sftpFactory"
    class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
    <property name="host" value="${SFTP_HOST}"></property>
    <property name="port" value="${SFTPPORT}"></property>
    <property name="user" value="${SFTPUSERNAME}"></property>
    <property name="password" value="${SFTPPASSWORD}"></property>
</bean>

<sftp:inbound-channel-adapter id="ftpInBound" channel="inChannel"
    session-factory="sftpFactory" 
    delete-remote-files="true" remote-directory="/Files"
    local-directory="file:C:/Bhaji">
    <int:poller id="poller" fixed-rate="10000"/>
</sftp:inbound-channel-adapter>

<int:service-activator input-channel="inChannel"
    output-channel="nullChannel" ref="inFileHandler" method="handler" />
 @Autowired
    private ExecutorService executorService;

    private static Logger log = LoggerFactory.getLogger(FileProcessHandler.class);

    public File handler(File input) {
        **//Doing some time taking process**
        return input;
}