Ftp Spring集成:从数据库获取轮询表达式

Ftp Spring集成:从数据库获取轮询表达式,ftp,spring-integration,poller,Ftp,Spring Integration,Poller,我有一个FTP消息源,我希望使用户能够通过应用程序配置轮询频率 这是入站通道适配器的当前配置 @Bean @InboundChannelAdapter(channel = "fromSmartpath", poller = @Poller(cron = "0 15 8 ? * MON,TUE,WED,THU,FRI,SAT")) public MessageSource<File> sftpMessageSource() throws SftpException { Sftp

我有一个FTP消息源,我希望使用户能够通过应用程序配置轮询频率

这是入站通道适配器的当前配置

@Bean
@InboundChannelAdapter(channel = "fromSmartpath", poller = @Poller(cron = "0 15 8 ? * MON,TUE,WED,THU,FRI,SAT"))
public MessageSource<File> sftpMessageSource() throws SftpException {
    SftpInboundFileSynchronizingMessageSource source = new SftpInboundFileSynchronizingMessageSource(
            sftpInboundFileSynchronizer());
    source.setLocalDirectory(new File(Constants.LOCAL_REPOSITORY_PATH));
    source.setAutoCreateLocalDirectory(true);
    source.setLocalFilter(new FileSystemPersistentAcceptOnceFileListFilter(metaDataStore(), "metastore"));
    return source;
}
@Bean
@InboundChannelAdapter(channel=“fromSmartpath”,poller=@poller(cron=“0 15 8”*周一、周二、周三、周四、周五、周六))
public MessageSource sftpMessageSource()引发SftpException{
SftpInboundFileSynchronizingMessageSource=新的SftpInboundFileSynchronizingMessageSource(
sftpInboundFileSynchronizer());
setLocalDirectory(新文件(Constants.LOCAL_REPOSITORY_PATH));
source.setAutoCreateLocalDirectory(true);
setLocalFilter(新文件SystemTempersistentAcceptonCefileListFilter(metaDataStore(),“metastore”);
返回源;
}
我的目标是从数据库中检索cron表达式。有没有办法做到这一点


谢谢

cron表达式在
CronTrigger
中结束。您可以开发一些服务,从数据库的
afterPropertieSet()
中选择一个表达式,并通过getter返回它。 然后为
CronTrigger
声明一个
@Bean
,并在其定义期间从服务调用该getter


@InboundChannelAdapter
上的
@Poller
有一个
触发器
选项来引用现有bean。

感谢您的响应@Polller确实有一个触发器选项,但它接受的是字符串而不是bean。该字符串必须是常量,因此定义一个从DB获取cron表达式的方法的可能性将不起作用。什么?'trigger'选项是一个bean引用。表示bean名称。完全不确定你不清楚的是什么。为
CronTrigger
创建一个
@Bean
,并在该选项中使用其名称。当然,注释不能引用对象。这不是他们的工作方式……好吧,这很尴尬(请原谅我的新保姆)。这对我很管用。另一个问题是,当用户更改数据库中的cron表达式时,如何重新加载InboundChannelAdapter以获取新的cron值?只有通过自定义触发器实现才能实现这一点