public class QuartzDeadlineManager extends AbstractDeadlineManager
DeadlineManager
that delegates scheduling and triggering to a Quartz Scheduler
.Constructor and Description |
---|
QuartzDeadlineManager(org.quartz.Scheduler scheduler,
ScopeAwareProvider scopeAwareProvider)
Initializes QuartzDeadlineManager with given
scheduler and scopeAwareProvider which will load
and send messages to Scope implementing components. |
QuartzDeadlineManager(org.quartz.Scheduler scheduler,
ScopeAwareProvider scopeAwareProvider,
TransactionManager transactionManager)
Initializes QuartzDeadlineManager with given
scheduler and scopeAwareProvider which will load
and send messages to Scope implementing components. |
QuartzDeadlineManager(org.quartz.Scheduler scheduler,
ScopeAwareProvider scopeAwareProvider,
TransactionManager transactionManager,
Serializer serializer)
Initializes QuartzDeadlineManager with given
scheduler and scopeAwareProvider which will load
and send messages to Scope implementing components. |
Modifier and Type | Method and Description |
---|---|
void |
cancelAll(String deadlineName)
Cancels all the deadlines corresponding to the given
deadlineName . |
void |
cancelSchedule(String deadlineName,
String scheduleId)
Cancels the deadline corresponding to the given
deadlineName / scheduleId combination. |
String |
generateScheduleId()
Generates a
String schedule id. |
void |
schedule(Duration triggerDuration,
String deadlineName,
Object messageOrPayload,
ScopeDescriptor deadlineScope,
String scheduleId)
Schedules a deadline after the given
triggerDuration with provided context. |
void |
schedule(Instant triggerDateTime,
String deadlineName,
Object messageOrPayload,
ScopeDescriptor deadlineScope,
String scheduleId)
Schedules a deadline at given
triggerDateTime with provided context. |
runOnPrepareCommitOrNow
public QuartzDeadlineManager(org.quartz.Scheduler scheduler, ScopeAwareProvider scopeAwareProvider)
scheduler
and scopeAwareProvider
which will load
and send messages to Scope
implementing components. A
NoTransactionManager
will be used as the transaction manager and the XStreamSerializer
for
serializing the JobDataMap
contents.scheduler
- A Scheduler
used for scheduling and triggering purposesscopeAwareProvider
- a List
of ScopeAware
components which are able to load and send
Messages to components which implement Scope
public QuartzDeadlineManager(org.quartz.Scheduler scheduler, ScopeAwareProvider scopeAwareProvider, TransactionManager transactionManager)
scheduler
and scopeAwareProvider
which will load
and send messages to Scope
implementing components. Uses the XStreamSerializer
for serializing the deadline message and scope in to the JobDataMap
.scheduler
- A Scheduler
used for scheduling and triggering purposesscopeAwareProvider
- a List
of ScopeAware
components which are able to load and send
Messages to components which implement Scope
transactionManager
- A TransactionManager
which builds transactions and ties them to deadlinepublic QuartzDeadlineManager(org.quartz.Scheduler scheduler, ScopeAwareProvider scopeAwareProvider, TransactionManager transactionManager, Serializer serializer)
scheduler
and scopeAwareProvider
which will load
and send messages to Scope
implementing components. Uses the given serializer
for serializing the deadline message and scope in to the JobDataMap
.scheduler
- A Scheduler
used for scheduling and triggering purposesscopeAwareProvider
- a List
of ScopeAware
components which are able to load and send
Messages to components which implement Scope
transactionManager
- A TransactionManager
which builds transactions and ties them to deadlineserializer
- The Serializer
which will be used to de-/serialize the DeadlineMessage
and the ScopeDescriptor
into the JobDataMap
public void schedule(Instant triggerDateTime, String deadlineName, Object messageOrPayload, ScopeDescriptor deadlineScope, String scheduleId)
DeadlineManager
triggerDateTime
with provided context. The provided deadlineName
/
scheduleId
combination can be used to cancel the scheduled deadline.
The given messageOrPayload
may be any object, as well as a DeadlineMessage. In the latter case, the
instance provided is the donor for the payload and MetaData
of the actual
deadline being used. In the former case, the given messageOrPayload
will be wrapped as the payload of a
DeadlineMessage
.
Scheduling a deadline with the same deadlineName
and scheduleId
will replace the previous
schedule with the new one.
triggerDateTime
- A Instant
denoting the moment to trigger the deadline handlingdeadlineName
- A String
representing the name of the deadline to schedulemessageOrPayload
- A Message
or payload for a message as an
Object
deadlineScope
- A ScopeDescriptor
describing the scope within which the deadline was scheduledscheduleId
- A String
schedule id to use when cancelling the schedulepublic void schedule(Duration triggerDuration, String deadlineName, Object messageOrPayload, ScopeDescriptor deadlineScope, String scheduleId)
DeadlineManager
triggerDuration
with provided context. The provided
deadlineName
/ scheduleId
combination can be used to cancel the scheduled deadline.
The given messageOrPayload
may be any object, as well as a DeadlineMessage. In the latter case, the
instance provided is the donor for the payload and MetaData
of the actual
deadline being used. In the former case, the given messageOrPayload
will be wrapped as the payload of a
DeadlineMessage
.
Scheduling a deadline with the same deadlineName
and scheduleId
will replace the previous
schedule with the new one.
triggerDuration
- A Duration
describing the waiting period before handling the deadlinedeadlineName
- A String
representing the name of the deadline to schedulemessageOrPayload
- A Message
or payload for a message as an
Object
deadlineScope
- A ScopeDescriptor
describing the scope within which the deadline was scheduledscheduleId
- A String
schedule id to use when cancelling the schedulepublic String generateScheduleId()
DeadlineManager
String
schedule id.String
schedule idpublic void cancelSchedule(String deadlineName, String scheduleId)
DeadlineManager
deadlineName
/ scheduleId
combination.
This method has no impact on deadlines which have already been triggered.public void cancelAll(String deadlineName)
DeadlineManager
deadlineName
.
This method has no impact on deadlines which have already been triggered.deadlineName
- A String
representing the name of the deadlines to cancelCopyright © 2010–2018. All rights reserved.