如何在 Spring Integration 中使用 ShedLock?

问题描述

我正在结合 Spring Batch 和 Spring Integration,我正在使用带有玉米的轮询器:

@Bean
@SchedulerLock(name = "importEntitiesRiskCodes",lockAtMostForString = "PT5M")
public IntegrationFlow integrationFlow() {
    return IntegrationFlows.from(fileReadingMessageSource(),c -> c.poller(Pollers.cron("0-7 1-59/5 * * * ?").maxMessagesPerPoll(maxFilesPerPoll)))
            .channel(fileIn())
            .transform(fileMessagetoJobrequest())
            .handle(jobLaunchingGateway())
            .log()
            .get();
}

我知道 Spring Integration JDBC 提供了 JDBCLockRepository,但我想知道如何使用 ShedLock。

解决方法

从您的描述中根本不清楚您将如何使用该锁,但根据此 article,看起来与 Spring Integration 无关。

另一方面,即使我不熟悉库,将 ShedLock 的 LockRegistry 实现添加到 Spring Integration 中也不错。尽管它可能与您的任务无关...

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...