|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.eventhandling.scheduling.quartz.QuartzEventScheduler
public class QuartzEventScheduler
EventScheduler implementation that delegates scheduling and triggering to a Quartz Scheduler.
QuartzEventScheduler.DirectEventJobDataBinder
,
FireEventJob
Nested Class Summary | |
---|---|
static class |
QuartzEventScheduler.DirectEventJobDataBinder
Binds the EventMessage as is to JobDataMap under QuartzEventScheduler.DirectEventJobDataBinder.EVENT_KEY . |
Constructor Summary | |
---|---|
QuartzEventScheduler()
|
Method Summary | |
---|---|
protected org.quartz.JobDetail |
buildJobDetail(EventMessage event,
org.quartz.JobKey jobKey)
Builds the JobDetail instance for Quartz, which defines the Job that needs to be executed when the trigger fires. |
protected org.quartz.Trigger |
buildTrigger(org.joda.time.DateTime triggerDateTime,
org.quartz.JobKey jobKey)
Builds a Trigger which fires the Job identified by jobKey at (or around) the given
triggerDateTime . |
void |
cancelSchedule(ScheduleToken scheduleToken)
Cancel the publication of a scheduled event. |
void |
initialize()
Initializes the QuartzEventScheduler. |
ScheduleToken |
schedule(org.joda.time.DateTime triggerDateTime,
Object event)
Schedule the given event for publication at the given triggerDateTime . |
ScheduleToken |
schedule(org.joda.time.Duration triggerDuration,
Object event)
Schedule the given event for publication after the given triggerDuration . |
void |
setEventBus(EventBus eventBus)
Sets the event bus to which scheduled events need to be published. |
void |
setEventJobDataBinder(EventJobDataBinder jobDataBinder)
Sets the QuartzEventScheduler.DirectEventJobDataBinder instance which reads / writes the event message to publish to the
JobDataMap . |
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. |
void |
setTransactionManager(TransactionManager transactionManager)
Sets the transaction manager that manages a transaction around the publication of an event. |
void |
setUnitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory)
Sets the Unit of Work Factory instance which provides the UnitOfWork that manages the publication of the scheduled event. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QuartzEventScheduler()
Method Detail |
---|
public ScheduleToken schedule(org.joda.time.DateTime triggerDateTime, Object event)
EventScheduler
event
for publication at the given triggerDateTime
. The returned
ScheduleToken can be used to cancel the planned publication.
The given event
may be any object, as well as an EventMessage. In the latter case, the instance
provided is the donor for the payload and Meta Data of the actual message being dispatched. In the former case,
the given event
will be wrapped as the payload of an EventMessage.
schedule
in interface EventScheduler
triggerDateTime
- The moment to trigger publication of the eventevent
- The event to publish
protected org.quartz.JobDetail buildJobDetail(EventMessage event, org.quartz.JobKey jobKey)
jobKey
and represent a Job that dispatches
the given event
.
This method may be safely overridden to change behavior. Defaults to a JobDetail to fire a FireEventJob
.
event
- The event to be scheduled for dispatchjobKey
- The key of the Job to schedule
protected org.quartz.Trigger buildTrigger(org.joda.time.DateTime triggerDateTime, org.quartz.JobKey jobKey)
jobKey
at (or around) the given
triggerDateTime
.
triggerDateTime
- The time at which a trigger was requestedjobKey
- The key of the job to be triggered
jobKey
public ScheduleToken schedule(org.joda.time.Duration triggerDuration, Object event)
EventScheduler
event
for publication after the given triggerDuration
. The
returned ScheduleToken can be used to cancel the planned publication.
The given event
may be any object, as well as an EventMessage. In the latter case, the instance
provided is the donor for the payload and Meta Data of the actual message being dispatched. In the former case,
the given event
will be wrapped as the payload of an EventMessage.
schedule
in interface EventScheduler
triggerDuration
- The amount of time to wait before publishing the eventevent
- The event to publish
public void cancelSchedule(ScheduleToken scheduleToken)
EventScheduler
cancelSchedule
in interface EventScheduler
scheduleToken
- the token returned when the event was scheduled@PostConstruct public void initialize() throws org.quartz.SchedulerException
EventBus
available to the Quartz Scheduler.
org.quartz.SchedulerException
- if an error occurs preparing the Quartz Scheduler for use.public void setScheduler(org.quartz.Scheduler scheduler)
scheduler
- the backing Quartz Scheduler for this timerpublic void setEventBus(EventBus eventBus)
eventBus
- the event bus to which scheduled events need to be published.public void setGroupIdentifier(String groupIdentifier)
groupIdentifier
- the group identifier to use when scheduling jobs with Quartzpublic void setTransactionManager(TransactionManager transactionManager)
setUnitOfWorkFactory(org.axonframework.unitofwork.UnitOfWorkFactory)
which is configured with the proper
transaction manager.
transactionManager
- the callback to invoke before and after publication of a scheduled eventpublic void setUnitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory)
setTransactionManager(org.axonframework.unitofwork.TransactionManager)
is used. In that case, a Transactional
instance of a DefaultUnitOfWorkFactory is used.
unitOfWorkFactory
- The UnitOfWorkFactory that creates the Unit Of Work for the Event Publicationpublic void setEventJobDataBinder(EventJobDataBinder jobDataBinder)
QuartzEventScheduler.DirectEventJobDataBinder
instance which reads / writes the event message to publish to the
JobDataMap
. Defaults to QuartzEventScheduler.DirectEventJobDataBinder
.
jobDataBinder
- to use
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |