Git Product home page Git Product logo

akron's Introduction

A crontab actor for Akka

Build Status

Currently for running on a single node actor system.

Requirements

  • Java 8
  • Akka 2.4 or 2.5
  • Scala 2.11 or 2.12

How to use

Add to your build sbt:

libraryDependencies += "com.markatta" %% "akron" % "1.2"

Usage example

import com.markatta.akron._

val system = ActorSystem("system")

val crontab = system.actorOf(CronTab.props, "crontab")

val someOtherActor = system.actorOf(SomeOtherActor.props, "etc")

// send woo to someOtherActor once every minute
crontab ! CronTab.Schedule(someOtherActor, "woo", CronExpression("* * * * *"))

// there is also a type safe DSL for the expressions
import DSL._
crontab ! CronTab.Schedule(
  someOtherActor, 
  "wee", 
  CronExpression(20, *, (mon, tue, wed), (feb, oct), *))
  

Scheduling a job gives it an unique id which is sent back in a CronTab.Scheduled that can be used later to unschedule that job. The crontab will watch the actor scheduled to receive messages for termination and if terminated will remove all jobs sending messages to it.

CronTab.Unschedule(id) can be used to unschedule jobs.

CronTab.GetListOfJobs can be used to get a CronTab.ListOfJobs back with all current crontab jobs.

Changelog

1.2

  • Artifacts for both Scala 2.11 and 2.12
  • Alpha/preview of persistent crontab (serialization format may change in the future) which will allow for running for example a cluster singleton crontab that is resilient.

1.1

  • Order of hour and minute not according to "normal" cron expressions fixed

1.0

  • First release - all the things

License

Apache License, Version 2.0

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.