I am trying to use Shedlock for running scheduled task in a clustered environment. But the moment I add @EnableSchedulerLock annotation, the scheduler task does not start at all.
I see that I need to provide LockProvider. I am using Redis/Lettuce in a clustered environment and I don't see a integration with lettuce shedlock.
Is there a way I can still use Shedlock ?
My maven dependency is :
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-spring</artifactId>
<version>4.24.0</version>
</dependency>
Main Spring application is
@SpringBootApplication
@EnableSchedulerLock(defaultLockAtMostFor = "10s")
public class MainApplication {
....
ScheduledTask class
@Component
@EnableScheduling
public class SchedulerTask {
@Scheduled(fixedRate = 3000)
@SchedulerLock(name = "scheduledTaskPods", lockAtMostFor = "5s", lockAtLeastFor = "2s")
public void populateDatacenterPods() {
LockAssert.assertLocked();
System.out.println("This is a schedule test");
}
}