Scheduled job is not starting

824 views Asked by At

I have been trying to implement the Shedlock on my spring boot application with no apparent use, I have used the formal guide available on https://github.com/lukas-krecan/ShedLock, please find below my configurations

Maven Dependencies:

    <dependency>
        <groupId>net.javacrumbs.shedlock</groupId>
        <artifactId>shedlock-spring</artifactId>
        <version>4.13.0</version>
    </dependency>
    <dependency>
        <groupId>net.javacrumbs.shedlock</groupId>
        <artifactId>shedlock-provider-mongo</artifactId>
        <version>4.13.0</version>
    </dependency>

Application.java

@SpringBootApplication
@EnableReactiveMongoRepositories
@EnableMongoRepositories
@EnableScheduling
@EnableSchedulerLock(defaultLockAtMostFor = "10m")

public class IrishPubApplication {
   public static void main(String[] args) {
       SpringApplication.run(IrishPubApplication.class, args);
    }

    @Bean
    public LockProvider lockProvider(MongoClient mongo) {
        return new MongoLockProvider(mongo.getDatabase("shedLock"));
    }
}

Scheduled Task:

@Scheduled(cron = "${retry.job.cron.time}")
@SchedulerLock(name = "myTask", lockAtMostFor = "10m", lockAtLeastFor = "1m")
public void processMessage() {
   .....
}

No matter what I try the task does not start in the first place, any ideas

0

There are 0 answers