Giter VIP home page Giter VIP logo

job.apex's Introduction

Job.apex

Job.apex is a library that aims to easily create and manage Apex scheduled jobs.

Why Job.apex?

Job.apex is created to offer a readable and fluent API to create Apex scheduled jobs as an alternative to the normal cron expression way. Besides, Job.apex supports a repeating job to work around the limitation in Apex that scheduled jobs cannot run in an interval less than 1 hour. Also Job.apex has API to manage all the scheduled jobs.

Dependencies

Job.apex has a dependency on R.apex. Please include R.apex before getting started with Job.apex.

Examples

Create a Custom Job

public class CustomJob extends Func {
    public CustomJob() {
        super(1);
    }

    public override Object exec(Object context) {
        System.debug('Custom job executed');
        return null;
    }
}

Job j = new Job('test', new CustomJob());

Every Day Job

new Job('test', new CustomJob())
    .everyDay()
    .atHour(8)
    .schedule();
// Schedule a job that runs at 8:00 everyday

Every Week Day Job

new Job('test', new CustomJob())
    .betweenDaysOfWeek('Mon', 'Fri')
    .atHour(8)
    .schedule();
// Schedule a job that runs at 8:00 every week day

Every Other Day Job

new Job('test', new CustomJob())
    .fromDay(1)
    .everyDays(2)
    .atHour(8)
    .schedule();
// Schedule a job that runs at 8:00 every other day from day 1

Second Sun in May Job

new Job('test', new CustomJob())
    .inMonth('May')
    .on2nd('Sun')
    .atHour(8)
    .schedule();
// Schedule a job that runs at 8:00 on the second Sunday of May

Last Week Day of Every Month Job

new Job('test', new CustomJob())
    .onLastWeekdayOfMonth()
    .atHour(8)
    .schedule();
// Schedule a job that runs at 8:00 on the last week day of every month

Nearest Week Day Job

new Job('test', new CustomJob())
    .inMonth('Sept')
    .onNearestWeekday(20)
    .atHour(8)
    .schedule();
// Schedule a job that runs at 8:00 on the nearest week day of 9/20

Every 30 Minutes Job

new Job('test', new CustomJob())
    .startNow()
    .everyMinutes(30)
    .repeatForever()
    .schedule();
// Schedule a job that first runs 30 minutes after now, and then repeats itself forever

job.apex's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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