public class StubDeadlineManager extends Object implements org.axonframework.deadline.DeadlineManager
DeadlineManager. Records all scheduled, canceled 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 |
cancelAllWithinScope(String deadlineName,
org.axonframework.messaging.ScopeDescriptor scope) |
void |
cancelSchedule(String deadlineName,
String scheduleId) |
Instant |
getCurrentDateTime()
Return the current date and time as an
Instant as is being used by this DeadlineManager. |
List<ScheduledDeadlineInfo> |
getDeadlinesMet()
Return all deadlines which have been met.
|
List<ScheduledDeadlineInfo> |
getScheduledDeadlines()
Return all scheduled deadlines which have not been met (yet).
|
void |
initializeAt(TemporalAccessor currentDateTime)
Resets the initial "current time" of this manager.
|
org.axonframework.common.Registration |
registerDispatchInterceptor(org.axonframework.messaging.MessageDispatchInterceptor<? super org.axonframework.deadline.DeadlineMessage<?>> dispatchInterceptor) |
org.axonframework.common.Registration |
registerHandlerInterceptor(org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.deadline.DeadlineMessage<?>> handlerInterceptor) |
String |
schedule(Duration triggerDuration,
String deadlineName,
Object payloadOrMessage,
org.axonframework.messaging.ScopeDescriptor deadlineScope) |
String |
schedule(Instant triggerDateTime,
String deadlineName,
Object payloadOrMessage,
org.axonframework.messaging.ScopeDescriptor deadlineScope) |
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 String schedule(Instant triggerDateTime, String deadlineName, Object payloadOrMessage, org.axonframework.messaging.ScopeDescriptor deadlineScope)
schedule in interface org.axonframework.deadline.DeadlineManagerpublic String schedule(Duration triggerDuration, String deadlineName, Object payloadOrMessage, org.axonframework.messaging.ScopeDescriptor deadlineScope)
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 void cancelAllWithinScope(String deadlineName, org.axonframework.messaging.ScopeDescriptor scope)
cancelAllWithinScope in interface org.axonframework.deadline.DeadlineManagerpublic List<ScheduledDeadlineInfo> getScheduledDeadlines()
public List<ScheduledDeadlineInfo> getDeadlinesMet()
public Instant getCurrentDateTime()
Instant as is being used by this DeadlineManager.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 triggerpublic org.axonframework.common.Registration registerDispatchInterceptor(org.axonframework.messaging.MessageDispatchInterceptor<? super org.axonframework.deadline.DeadlineMessage<?>> dispatchInterceptor)
registerDispatchInterceptor in interface org.axonframework.messaging.MessageDispatchInterceptorSupport<org.axonframework.deadline.DeadlineMessage<?>>public org.axonframework.common.Registration registerHandlerInterceptor(org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.deadline.DeadlineMessage<?>> handlerInterceptor)
registerHandlerInterceptor in interface org.axonframework.messaging.MessageHandlerInterceptorSupport<org.axonframework.deadline.DeadlineMessage<?>>Copyright © 2010–2022. All rights reserved.