org.axonframework.eventhandling.scheduling.quartz
Class QuartzEventScheduler

java.lang.Object
  extended by org.axonframework.eventhandling.scheduling.quartz.QuartzEventScheduler
All Implemented Interfaces:
EventScheduler

public class QuartzEventScheduler
extends Object
implements EventScheduler

Since:
0.7
Author:
Allard Buijze

Constructor Summary
QuartzEventScheduler()
           
 
Method Summary
 void cancelSchedule(ScheduleToken scheduleToken)
          Cancel the publication of a scheduled event.
 void initialize()
          Initializes the QuartzEventScheduler.
 ScheduleToken schedule(org.joda.time.DateTime triggerDateTime, ApplicationEvent event)
          Schedule the given event for publication at the given triggerDateTime.
 ScheduleToken schedule(org.joda.time.Duration triggerDuration, ApplicationEvent event)
          Schedule the given event for publication after the given triggerDuration.
 ScheduleToken schedule(ScheduledEvent event)
          Schedules the given event for publication.
 void setEventBus(EventBus eventBus)
          Sets the event bus to which scheduled events need to be published.
 void setGroupIdentifier(String groupIdentifier)
          Sets the group identifier to use when scheduling jobs with Quartz.
 void setScheduler(org.quartz.Scheduler scheduler)
          Sets the backing Quartz Scheduler for this timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuartzEventScheduler

public QuartzEventScheduler()
Method Detail

schedule

public ScheduleToken schedule(org.joda.time.DateTime triggerDateTime,
                              ApplicationEvent event)
Description copied from interface: EventScheduler
Schedule the given event for publication at the given triggerDateTime. The returned ScheduleToken can be used to cancel the planned publication.

Specified by:
schedule in interface EventScheduler
Parameters:
triggerDateTime - The moment to trigger publication of the event
event - The event to publish
Returns:
the token to use when cancelling the schedule

schedule

public ScheduleToken schedule(org.joda.time.Duration triggerDuration,
                              ApplicationEvent event)
Description copied from interface: EventScheduler
Schedule the given event for publication after the given triggerDuration. The returned ScheduleToken can be used to cancel the planned publication.

Specified by:
schedule in interface EventScheduler
Parameters:
triggerDuration - The amount of time to wait before publishing the event
event - The event to publish
Returns:
the token to use when cancelling the schedule

schedule

public ScheduleToken schedule(ScheduledEvent event)
Description copied from interface: EventScheduler
Schedules the given event for publication. The event contains the time at which it should be published. The returned ScheduleToken can be used to cancel the planned publication.

Specified by:
schedule in interface EventScheduler
Parameters:
event - The event to publish
Returns:
the token to use when cancelling the schedule

cancelSchedule

public void cancelSchedule(ScheduleToken scheduleToken)
Description copied from interface: EventScheduler
Cancel the publication of a scheduled event. If the events has already been published, this method does nothing.

Specified by:
cancelSchedule in interface EventScheduler
Parameters:
scheduleToken - the token returned when the event was scheduled

initialize

@PostConstruct
public void initialize()
                throws org.quartz.SchedulerException
Initializes the QuartzEventScheduler. Will make the configured Event Bus available to the Quartz Scheduler

Throws:
org.quartz.SchedulerException - if an error occurs preparing the Quartz Scheduler for use.

setScheduler

public void setScheduler(org.quartz.Scheduler scheduler)
Sets the backing Quartz Scheduler for this timer.

Parameters:
scheduler - the backing Quartz Scheduler for this timer

setEventBus

public void setEventBus(EventBus eventBus)
Sets the event bus to which scheduled events need to be published.

Parameters:
eventBus - the event bus to which scheduled events need to be published.

setGroupIdentifier

public void setGroupIdentifier(String groupIdentifier)
Sets the group identifier to use when scheduling jobs with Quartz. Defaults to "AxonFramework-Events".

Parameters:
groupIdentifier - the group identifier to use when scheduling jobs with Quartz


Copyright © 2011. All Rights Reserved.