Package org.qi4j.library.scheduler

Qi4j Library - Scheduler

See:
          Description

Interface Summary
Scheduler Scheduler.
SchedulerConfiguration Configuration for the Scheduler.
SchedulerService  
 

Class Summary
SchedulerActivation Handle the Scheduler activation and passivation.
SchedulerMixin  
 

Package org.qi4j.library.scheduler Description

Qi4j Library - Scheduler

Logging

The SLF4J Logger used by this library is named "org.qi4j.library.scheduler".

Assembly

Use SchedulerAssembler to add the Scheduler service to your Application. This Assembler provide a fluent api to programmatically configure configuration defaults and activate the Timeline service assembly that allow to browse in past and future Task runs.

Here is a full example:

        new SchedulerAssembler().
              visibleIn( Visibility.layer ).
              withConfigAssembly( configModuleAssembly ).
              withPulseRhythm( 60 ).
              withGarbageCollectorRhythm( 600 ).
              withTimeline().
              assemble( moduleAssembly );
        

See SchedulerConfiguration for configuration properties details, the values show above are the defaults.

Writing Tasks

To write a schedulable Task, compose an EntityComposite using Task to be able to schedule it.

A Task is wrapped in a ScheduleRunner before being run by SchedulerWorkQueue. ScheduleRunner wrap a UnitOfWork around the Task#run() invocation.

Here is a simple example:

        interface MyTaskEntity
            extends Task, EntityComposite
        {
            Property<String> customState();
            Association<AnotherEntity> anotherEntity();
        }

        abstract class MyTaskMixin
            implements Runnable
        {