Spring integration FTP/FTPS适配器自定义触发器/轮询器

Spring integration FTP/FTPS适配器自定义触发器/轮询器,spring-integration,Spring Integration,首先,我今天才开始研究Spring集成,所以我的经验很少。我已经使用spring integration进行了基本的计划ftp文件解析器设置: <int:channel id="ftpIn" /> <int-ftp:inbound-channel-adapter channel="ftpIn" session-factory="ftpClientFactory" filename-pattern="*.xml" local-director

首先,我今天才开始研究Spring集成,所以我的经验很少。我已经使用spring integration进行了基本的计划ftp文件解析器设置:

<int:channel id="ftpIn"  />

<int-ftp:inbound-channel-adapter 
    channel="ftpIn"
    session-factory="ftpClientFactory"
    filename-pattern="*.xml"
    local-directory="${TEMP_DIR}">

    <int:poller fixed-rate="${ftp.polling.rate}" />

</int-ftp:inbound-channel-adapter>

<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
    <property name="host" value="${ftp.host}" />
    <property name="port" value="${ftp.port}" />
    <property name="username" value="${ftp.username}" />
    <property name="password" value="${ftp.password}" />
</bean>

<int:service-activator
    input-channel="ftpIn"
    method="handle"
    ref="ftpInHandler" />

<bean id="ftpInHandler" class="thanks.for.looking.FtpInHandler" />

这是有效的;但是,我想添加额外的功能,在启动计划(固定速率)ftp适配器之前检查(以固定速率)系统是否准备就绪。我一直在寻找实现这一点的最佳方法。任何帮助或指导都将不胜感激

致以最良好的祝愿

Jared有一个类似于
的选项

因此,您只需编写一些自定义的
建议

public class CheckSystemInterceptor implements MethodInterceptor {

    Object invoke(MethodInvocation invocation) throws Throwable {
          return mySystem.isOK() ? invocation.proceed() : null;
    }

}
使用
系统检查器将其配置为
,并将其注入该

它将在每次轮询时调用。

或设置
auto startup=“false”
,并仅在准备就绪时启动适配器。或者,我通常建议在使用FTP执行“按需”类型的应用程序时使用出站网关(LS、GET等)。