public class StubDeadlineManager extends Object implements org.axonframework.deadline.DeadlineManager
DeadlineManager. Records all scheduled and met deadlines.| Constructor and Description |
|---|
StubDeadlineManager()
Initializes the manager with
ZonedDateTime.now() as current time. |
StubDeadlineManager(TemporalAccessor currentDateTime)
Initializes the manager with provided
currentDateTime as current time. |
| Modifier and Type | Method and Description |
|---|---|
void |
advanceTimeBy(Duration duration,
DeadlineConsumer deadlineConsumer)
Advances time by the given
duration and invokes the given deadlineConsumer for each deadline
scheduled until that time. |
void |
advanceTimeTo(Instant newDateTime,
DeadlineConsumer deadlineConsumer)
Advances time to the given
newDateTime and invokes the given deadlineConsumer for each deadline
scheduled until that time. |
ScheduledDeadlineInfo |
advanceToNextTrigger()
Advances the "current time" of the manager to the next scheduled deadline, and returns that deadline.
|
void |
cancelAll(String deadlineName) |
void |
cancelSchedule(String deadlineName,
String scheduleId) |
Instant |
getCurrentDateTime() |
List<ScheduledDeadlineInfo> |
getDeadlinesMet() |
List<ScheduledDeadlineInfo> |
getScheduledDeadlines() |
void |
initializeAt(TemporalAccessor currentDateTime)
Resets the initial "current time" of this manager.
|
void |
schedule(Duration triggerDuration,
String deadlineName,
Object payloadOrMessage,
org.axonframework.messaging.ScopeDescriptor deadlineScope,
String scheduleId) |
void |
schedule(Instant triggerDateTime,
String deadlineName,
Object payloadOrMessage,
org.axonframework.messaging.ScopeDescriptor deadlineScope,
String scheduleId) |
public StubDeadlineManager()
ZonedDateTime.now() as current time.public StubDeadlineManager(TemporalAccessor currentDateTime)
currentDateTime as current time.currentDateTime - The instance to use as current date and timepublic void initializeAt(TemporalAccessor currentDateTime) throws IllegalStateException
currentDateTime - The instant to use as the current date and timeIllegalStateException - when calling this method after deadlines are scheduledpublic void schedule(Instant triggerDateTime, String deadlineName, Object payloadOrMessage, org.axonframework.messaging.ScopeDescriptor deadlineScope, String scheduleId)
schedule in interface org.axonframework.deadline.DeadlineManagerpublic void schedule(Duration triggerDuration, String deadlineName, Object payloadOrMessage, org.axonframework.messaging.ScopeDescriptor deadlineScope, String scheduleId)
schedule in interface org.axonframework.deadline.DeadlineManagerpublic void cancelSchedule(String deadlineName, String scheduleId)
cancelSchedule in interface org.axonframework.deadline.DeadlineManagerpublic void cancelAll(String deadlineName)
cancelAll in interface org.axonframework.deadline.DeadlineManagerpublic List<ScheduledDeadlineInfo> getScheduledDeadlines()
public List<ScheduledDeadlineInfo> getDeadlinesMet()
public Instant getCurrentDateTime()
public ScheduledDeadlineInfo advanceToNextTrigger()
ScheduledDeadlineInfo of the first scheduled deadlinepublic void advanceTimeTo(Instant newDateTime, DeadlineConsumer deadlineConsumer)
newDateTime and invokes the given deadlineConsumer for each deadline
scheduled until that time.newDateTime - The time to advance the "current time" of the manager todeadlineConsumer - The consumer to invoke for each deadline to triggerpublic void advanceTimeBy(Duration duration, DeadlineConsumer deadlineConsumer)
duration and invokes the given deadlineConsumer for each deadline
scheduled until that time.duration - The amount of time to advance the "current time" of the manager withdeadlineConsumer - The consumer to invoke for each deadline to triggerCopyright © 2010–2018. All rights reserved.