public class AxonServerEventScheduler extends Object implements EventScheduler
EventScheduler
that uses Axon Server to schedule the events.Modifier and Type | Class and Description |
---|---|
static class |
AxonServerEventScheduler.Builder
Builder class to instantiate an
AxonServerEventScheduler . |
Modifier | Constructor and Description |
---|---|
protected |
AxonServerEventScheduler(AxonServerEventScheduler.Builder builder)
Instantiates an
AxonServerEventScheduler using the given AxonServerEventScheduler.Builder . |
Modifier and Type | Method and Description |
---|---|
static AxonServerEventScheduler.Builder |
builder()
Instantiate a Builder to be able to create a
AxonServerEventScheduler . |
void |
cancelSchedule(ScheduleToken scheduleToken)
Cancel a scheduled event.
|
ScheduleToken |
reschedule(ScheduleToken scheduleToken,
Duration triggerDuration,
Object event)
Changes the trigger time for a scheduled event.
|
ScheduleToken |
schedule(Duration triggerDuration,
Object event)
Schedules an event to be published after a specified amount of time.
|
ScheduleToken |
schedule(Instant triggerDateTime,
Object event)
Schedules an event to be published at a given moment.
|
void |
shutdownDispatching()
Shuts down the Axon Server
EventScheduler implementation. |
void |
start()
Start the Axon Server
EventScheduler implementation. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
reschedule, shutdown
protected AxonServerEventScheduler(AxonServerEventScheduler.Builder builder)
AxonServerEventScheduler
using the given AxonServerEventScheduler.Builder
.
Will assert that the Serializer
and AxonServerConnectionManager
are not null
and will
throw an AxonConfigurationException
if this is the case.
builder
- the AxonServerEventScheduler.Builder
used.public static AxonServerEventScheduler.Builder builder()
AxonServerEventScheduler
.
The requestTimeout
is defaulted to 15000
millis.
The Serializer
and AxonServerConnectionManager
are hard requirements and as such
should be provided.
AxonServerEventScheduler
@StartHandler(phase=-10) public void start()
EventScheduler
implementation.@ShutdownHandler(phase=-10) public void shutdownDispatching()
EventScheduler
implementation.public ScheduleToken schedule(Instant triggerDateTime, Object event)
schedule
in interface EventScheduler
triggerDateTime
- The moment to trigger publication of the eventevent
- The event to publishpublic ScheduleToken schedule(Duration triggerDuration, Object event)
schedule
in interface EventScheduler
triggerDuration
- the amount of time to wait before publishing the eventevent
- the event to publishpublic void cancelSchedule(ScheduleToken scheduleToken)
cancelSchedule
in interface EventScheduler
scheduleToken
- the token returned when the event was scheduledpublic ScheduleToken reschedule(ScheduleToken scheduleToken, Duration triggerDuration, Object event)
reschedule
in interface EventScheduler
scheduleToken
- the token returned when the event was scheduled, might be nulltriggerDuration
- the amount of time to wait before publishing the eventevent
- the event to publishCopyright © 2010–2022. All rights reserved.