public class StubEventScheduler extends Object implements org.axonframework.eventhandling.scheduling.EventScheduler
| Constructor and Description |
|---|
StubEventScheduler()
Creates an instance of the StubScheduler that uses the current date time as its conceptual "current time".
|
StubEventScheduler(TemporalAccessor currentDateTime)
Creates an instance of the StubScheduler that uses the given
currentDateTime as its conceptual
"current time". |
| Modifier and Type | Method and Description |
|---|---|
void |
advanceTimeBy(Duration duration,
EventConsumer<org.axonframework.eventhandling.EventMessage<?>> eventConsumer)
Advance time by the given
duration and invokes the given eventConsumer for each
event scheduled for publication until that time. |
void |
advanceTimeTo(Instant newDateTime,
EventConsumer<org.axonframework.eventhandling.EventMessage<?>> eventConsumer)
Advance time to the given
newDateTime and invokes the given eventConsumer for each
event scheduled for publication until that time. |
org.axonframework.eventhandling.EventMessage |
advanceToNextTrigger()
Advances the "current time" of the scheduler to the next scheduled Event, and returns that event.
|
void |
cancelSchedule(org.axonframework.eventhandling.scheduling.ScheduleToken scheduleToken) |
Instant |
getCurrentDateTime()
Returns the "Current Date Time" as used by the scheduler.
|
List<ScheduledItem> |
getScheduledItems()
Returns a view of all the scheduled Events at the time this method is called.
|
void |
initializeAt(TemporalAccessor currentDateTime)
Resets the initial "current time" of this SubEventScheduler.
|
org.axonframework.eventhandling.scheduling.ScheduleToken |
schedule(Duration triggerDuration,
Object event) |
org.axonframework.eventhandling.scheduling.ScheduleToken |
schedule(Instant triggerDateTime,
Object event) |
public StubEventScheduler()
public StubEventScheduler(TemporalAccessor currentDateTime)
currentDateTime as its conceptual
"current time".currentDateTime - The instant to use as current Date and Timepublic void initializeAt(TemporalAccessor currentDateTime)
currentDateTime - The instant to use as the current Date and TimeIllegalStateException - when calling this method after events are scheduledpublic org.axonframework.eventhandling.scheduling.ScheduleToken schedule(Instant triggerDateTime, Object event)
schedule in interface org.axonframework.eventhandling.scheduling.EventSchedulerpublic org.axonframework.eventhandling.scheduling.ScheduleToken schedule(Duration triggerDuration, Object event)
schedule in interface org.axonframework.eventhandling.scheduling.EventSchedulerpublic void cancelSchedule(org.axonframework.eventhandling.scheduling.ScheduleToken scheduleToken)
cancelSchedule in interface org.axonframework.eventhandling.scheduling.EventSchedulerpublic List<ScheduledItem> getScheduledItems()
public Instant getCurrentDateTime()
public org.axonframework.eventhandling.EventMessage advanceToNextTrigger()
public void advanceTimeTo(Instant newDateTime, EventConsumer<org.axonframework.eventhandling.EventMessage<?>> eventConsumer)
newDateTime and invokes the given eventConsumer for each
event scheduled for publication until that time.newDateTime - The time to advance the "current time" of the scheduler toeventConsumer - The function to invoke for each event to triggerpublic void advanceTimeBy(Duration duration, EventConsumer<org.axonframework.eventhandling.EventMessage<?>> eventConsumer)
duration and invokes the given eventConsumer for each
event scheduled for publication until that time.duration - The amount of time to advance the "current time" of the scheduler witheventConsumer - The function to invoke for each event to triggerCopyright © 2010–2022. All rights reserved.