SpringIntegration Cron trigger



嗨,我正在使用带有触发器的SpringIntegration来轮询目录。到目前为止一切都很好。

但我在民意调查中遇到了问题,开始和结束时间分别为下午12:05和18:15

0 0/1 12-18 ? * MON-FRI

以上工作在12到18之间的每分钟都很好,但我找不到设置时间的方法

支持吗

@Bean
public IntegrationFlow inboundFileIntegration(
) {
CronTrigger cronTrigger = new CronTrigger("0 0/1 12-18 ? * MON-FRI");

return IntegrationFlows.from(fileReadingMessageSource(),
c -> c.poller(Pollers.trigger(cronTrigger)
.maxMessagesPerPoll(10).advice(new AbstractMessageSourceAdvice() {
@Override
public Message<?> afterReceive(Message<?> message, MessageSource<?> messageSource) {
System.out.println("after");
return message;
}
@Override
public boolean beforeReceive(MessageSource<?> source) {
System.out.println("before");
return true;
}
})))
//                        .transactionSynchronizationFactory(transactionSynchronizationFactory())
//                        .transactional(transactionManager())))
.log()
.transform(Files.toStringTransformer())
.transform(o -> {
//                    jmsTemplate.convertAndSend("testing_queue", o);
System.out.println(o);
return o;
})

.channel(ApplicationConfiguration.INBOUND_CHANNEL)
.get();
}

您可以像设置小时一样设置分钟:

0 15-35 12-17 1/1 * ? MON-FRI

最新更新