Skip to content

svarcheg/rx-cron-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rx-cron-scheduler

Main idea here is to add Quartz (http://quartz-scheduler.org/) calendars and crons to rx-java (https://github.com/Netflix/RxJava) schedulers. It is a "forwarding" scheduler implementation, so one can change the "inner" scheduler (to replace it by a TestScheduler for example) at will.

Build status

Build Status

Dependency status

Dependency Status

Installation

Available at clojars (https://clojars.org/com.ullink.rx/rx-cron-scheduler).

1/ Add a clojars repo. If you use gradle following should be enough:

repositories {
    mavenRepo url: 'http://clojars.org/repo'
}

2/ Add a dependency to your project. Using gradle:

compile 'com.ullink.rx:rx-cron-scheduler:1.5'

Usage

static class SideEffectTask implements Action0
{
   @Override
   public void call() {
      .. some stuff ...
   }
}
ExecutorService executor = Executors.newSingleThreadScheduledExecutor();
Scheduler inner = Schedulers.executor(executor);
RxCronScheduler service = new RxCronForwardingScheduler(inner);
final SideEffectTask task = new SideEffectTask();
WeeklyCalendar weeklyCalendar = new WeeklyCalendar();
boolean [] excluded = new boolean [] {false, false, true, true,true,true,true, true};
weeklyCalendar.setDaysExcluded(excluded);
service.schedule(task, new CronExpression("0 0 15 ? * *"), weeklyCalendar );

About

Quartz calendars and crons with rx-java schedulers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages