Giter Club home page Giter Club logo

java-dynamic-scheduling-tutorial's Introduction

Java Dynamic Scheduling Tutorial

SpringBoot has @Scheduled annotation for scheduling tasks. But it only works with fixed rates. In this tutorial I tried to show how to create our own scheduler for dynamic scheduling.

This repository created for my blog post on same topic: http://mbcoder.com/dynamic-task-scheduling-with-spring/

Breakdown of Services

AnnotationScheduler

This service shows how to use Spring's own scheduler with a fixed rate or cron expression.

DynamicScheduler

This service shows how to create our own scheduler and make it work with dynamic rates. In this service we can see how to use a value from database as our next execution time. We can also see using different approaches within the same scheduler such as using fixed values, dynamic values, cron expression etc.

CancellableScheduler

Same as dynamic scheduler but on top of that we can now cancel and re-activate the scheduler on demand.

ExactDateScheduler

In this service we see how to create a scheduler to schedule a job to be executed at an exact date instead of giving a rate.

ExternalScheduler

This is advanced version of cancellable scheduler and it is more like a production ready version. With this we can now easily add or remove jobs from other classes. As an example, SchedulingController shows how adding and removing job works from outside.


All the above classes are to demonstrate different possibilities of custom schedulers. You can combine those functionalities in your own scheduler according to your needs. If you have any question, or if you want to achieve something that is not done here yet, leave a comment in above blog post and I will try to help as soon as I can.

java-dynamic-scheduling-tutorial's People

Contributors

mustafabayar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.