How to use ShedLock in Spring Integration?

673 views Asked by At

I am combining the Spring Batch and Spring Integration, I am using the poller with a corn:

@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();
}

I know that Spring Integration JDBC provides JDBCLockRepository but I want to know how to use the ShedLock.

1

There are 1 answers

4
Artem Bilan On

It is not clear from your description how you are going to use that lock at all, but according to this article, it doesn't look like there is anything related to Spring Integration.

On the other hand, even if I'm not familiar with library, it doesn't look bad to add a LockRegistry implementation for ShedLock into Spring Integration. Although it might not be relevant to your task...