Spring Boot Scheduler | Spring Job Scheduler | @Scheduled Annotation | Async Scheduler

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ก.พ. 2022
  • In this video, I will explain how the Spring @Scheduled annotation can be used to configure and schedule tasks and will explain about fixed rate, fixed delay, async scheduler and task scheduler.
    My Top Playlists:
    Spring Boot with Angular : • Spring Boot + Angular
    Spring Boot with Docker & Docker Compose : • Spring Boot Docker & D...
    Spring Boot with Kubernetes : • Spring Boot Docker Kub...
    Spring Boot with AWS : • Spring Boot + AWS
    Spring Boot with Azure : • Spring Boot Azure
    Spring Data with Redis : • Spring Data with Redis
    Spring Boot with Apache Kafka : • Apache kafka
    Spring Boot with Resilience4J : • SpringBoot Resilience4j
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 16

  • @shwetabhat9981
    @shwetabhat9981 2 ปีที่แล้ว +1

    It's great to see you back sir . Thank you for such amazing content 🎉🎉

  • @stoicshubham8843
    @stoicshubham8843 ปีที่แล้ว

    Can we use fixedRateString with minutes also and if so, then how to define that in this?

  • @vamshikrishna2544
    @vamshikrishna2544 ปีที่แล้ว

    Is there a way schedule a job and run to pull data from storage only once even when running on multiple instances? So it won’t pull same record twice before my update back to storage.

  • @yucolen
    @yucolen ปีที่แล้ว

    Great video!
    Can you tell me how I could read this cron expression from a docker-compose?

  • @PsycheDevs
    @PsycheDevs ปีที่แล้ว

    very helpful sir

  • @sarulatha7374
    @sarulatha7374 2 ปีที่แล้ว +3

    How to schedule a task as per the end user request (like based on strat date or end date) using api call in springboot. Could you please make a video for that....It will be very useful

  • @PRAVEENPraveenkumar
    @PRAVEENPraveenkumar ปีที่แล้ว

    Is there any way to schedule a job once not with postConstruct?

  • @sunnymittal9542
    @sunnymittal9542 ปีที่แล้ว

    Sir, your videos are very helpful. Request you to please upload more videos.

  • @PrashantZombade
    @PrashantZombade 6 หลายเดือนก่อน

    Very well explained, thanks a lot for the hard work and sharing your knowledge.

  • @manivasuppalamarthi6948
    @manivasuppalamarthi6948 6 หลายเดือนก่อน

    Very useful and informative. How to make jobs synchronous when application instance running on multiple nodes?

    • @technotowntechie9732
      @technotowntechie9732  6 หลายเดือนก่อน +1

      You might encounter scenarios where you want to ensure that a scheduled job is executed only once, regardless of the number of nodes. To achieve this, you can use a distributed locking mechanism. One popular approach is to use a distributed lock manager like Apache ZooKeeper or Redis.
      @Component
      public class ScheduledTask {
      @Autowired
      private RedisTemplate redisTemplate;
      @Autowired
      private RedisScript distributedLockScript;
      @Scheduled(cron = "0 0 1 * * ?") // Example cron expression
      public void scheduledJob() {
      String lockKey = "your-lock-key";
      String lockValue = "unique-value";
      // Attempt to acquire the lock
      Boolean lockAcquired = redisTemplate.execute(distributedLockScript, Collections.singletonList(lockKey), lockValue);
      if (lockAcquired != null && lockAcquired) {
      try {
      // Your scheduled job logic goes here
      } finally {
      // Release the lock when the job is done
      redisTemplate.delete(lockKey);
      }
      } else {
      // Another node already acquired the lock, skip this execution
      }
      }
      }
      Please refer the below link as well
      stackoverflow.com/questions/31288810/spring-scheduled-task-running-in-clustered-environment

  • @lordgreat6051
    @lordgreat6051 ปีที่แล้ว

    for some reason my fixedrate is also stopping for 2 seconds because of thread sleep despite having fixedrate value set to 1000 only
    Edit: never mind, i got it! so fixed rate does not have to work according to the given time to it! instead it only takes out that time out of the tread sleep so like if we give 3 sec to fixed rather and thread sleep is on 5 sec thenmethod will run each 2 sec because 3 out of 5 is 2

  • @deepseWorld
    @deepseWorld ปีที่แล้ว +1

    LIKE LIKE LIKE LIKE

  • @cecilharper945
    @cecilharper945 2 ปีที่แล้ว

    ᑭяỖmo??