org.qi4j.library.scheduler

## Interface Scheduler

- All Known Subinterfaces:
    SchedulerService
  All Known Implementing Classes:
    SchedulerMixin

      @Concerns(value=UnitOfWorkConcern.class)
      public interface Scheduler

  Scheduler.

  This is the only interface you should use in your application for scheduling tasks.

  See `SchedulerConfiguration` for configuration properties.

  See in `SchedulerAssembler` how to assemble a `Scheduler` and optional `Timeline`.

  By default, a `Schedule` is not durable. In other words, it do not survive an `Application` restart.

  To make a `Schedule` durable, set it's durable property to true once its scheduled.

  Durable `Schedule`s that have no future run are removed by `SchedulerGarbageCollector` (not implemented?).

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Schedule` | `scheduleCron(Task task, String cronExpression, boolean durable)` Schedule a Task using a CronExpression.
    `Schedule` | `scheduleCron(Task task, String cronExpression, DateTime start, boolean durable)` Schedule a Task using a CronExpression starting at a given date.
    `Schedule` | `scheduleCron(Task task, String cronExpression, long initialDelay, boolean durable)` Schedule a Task using a CronExpression with a given initial delay in milliseconds.
    `Schedule` | `scheduleOnce(Task task, DateTime runAt, boolean durable)` Schedule a Task to be run after a given initial delay in seconds.
    `Schedule` | `scheduleOnce(Task task, int initialSecondsDelay, boolean durable)` Schedule a Task to be run after a given initial delay in seconds.

- - ### Method Detail

    - #### scheduleOnce

          @UnitOfWorkPropagation(value=MANDATORY)
          Schedule scheduleOnce(Task task,
                                                                  int initialSecondsDelay,
                                                                  boolean durable)

      Schedule a Task to be run after a given initial delay in seconds.
      Parameters:
        `task` - Task to be scheduled once
        `initialSecondsDelay` - Initial delay the Task will be run after, in seconds
        `durable` - true if this Schedule should survive a restart.
      Returns:
        The newly created Schedule

    - #### scheduleOnce

          @UnitOfWorkPropagation(value=MANDATORY)
          Schedule scheduleOnce(Task task,
                                                                  DateTime runAt,
                                                                  boolean durable)

      Schedule a Task to be run after a given initial delay in seconds.
      Parameters:
        `task` - Task to be scheduled once
        `runAt` - The future point in time when the Schedule will be run.
        `durable` - true if this Schedule should survive a restart.
      Returns:
        The newly created Schedule

    - #### scheduleCron

          @UnitOfWorkPropagation(value=MANDATORY)
          Schedule scheduleCron(Task task,
                                                                  String cronExpression,
                                                                  boolean durable)

      Schedule a Task using a CronExpression.
      Parameters:
        `task` - Task to be scheduled once
        `cronExpression` - CronExpression for creating the Schedule for the given Task
        `durable` - true if this Schedule should survive a restart.
      Returns:
        The newly created Schedule

    - #### scheduleCron

          @UnitOfWorkPropagation(value=MANDATORY)
          Schedule scheduleCron(Task task,
                                                                  String cronExpression,
                                                                  long initialDelay,
                                                                  boolean durable)

      Schedule a Task using a CronExpression with a given initial delay in milliseconds.
      Parameters:
        `task` - Task to be scheduled once
        `cronExpression` - CronExpression for creating the Schedule for the given Task
        `initialDelay` - Initial delay the Schedule will be active after, in milliseconds
        `durable` - true if this Schedule should survive a restart.
      Returns:
        The newly created Schedule

    - #### scheduleCron

          @UnitOfWorkPropagation(value=MANDATORY)
          Schedule scheduleCron(Task task,
                                                                  String cronExpression,
                                                                  DateTime start,
                                                                  boolean durable)

      Schedule a Task using a CronExpression starting at a given date.
      Parameters:
        `task` - Task to be scheduled once
        `cronExpression` - CronExpression for creating the Schedule for the given Task
        `start` - Date from which the Schedule will become active
        `durable` - true if this Schedule should survive a restart.
      Returns:
        The newly created Schedule