Code Monkey home page Code Monkey logo

simple-cron-scheduler's Introduction

An other simple Scheduler

A simple scheduler based on Akka.

Using scheduler

From Scala

    val stack = mutable.Stack[String]()

    val expression = CronExpression("0 0 2-3 * * * *")

    SimpleScheduler.start()
    
    SimpleScheduler.scheduleJob(expression, Job("Add to stack", Runnable {
      stack.push("Hi")
    }))
    

From Java

    CronExpression cronExpression = new CronExpression("* * * * * * *");
    
    SimpleScheduler.scheduleJob(cronExpression, new Job("A Job!", () -> System.out.println("run....")));
    
    SimpleScheduler.start();

Cron Expression

  • Pattern: "SM MH HD DM DW MY YY"
SM: Second of minute
MH: Minute of the hour
HD: Hour of the day
DM: Day of the Month
DW: Day of the week
MY: Month of the year
YY: Year
  • Each Cron Item can take:
"*": Match any value of a given instance
"\d+(,\d+)*": Match one value or a list of values
"\d+/\d+": Match a starting value and a step
"\d+-\d+(/\d+)": Match a range and optionaly a step inside the range

 Possible values depends on the domain of the particular cron item (eg: to Seconds will be 0-59)
  • Examples:
"* * * * * * *" -> Every second
"0 * * * * * *" -> Each 0 second of every minute
"* 0 * * * * *" -> Every second at minute 0 of every hour
"0 0 13 * 1 * *" -> Every monday at 1 PM

simple-cron-scheduler's People

Contributors

rodrigogdea avatar rodrigotn 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.