Class AxonServerEventScheduler
java.lang.Object
org.axonframework.axonserver.connector.event.axon.AxonServerEventScheduler
- All Implemented Interfaces:
EventScheduler,Lifecycle
Implementation of the
EventScheduler that uses Axon Server to schedule the events.- Since:
- 4.4
- Author:
- Marc Gathier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate anAxonServerEventScheduler.Nested classes/interfaces inherited from interface org.axonframework.lifecycle.Lifecycle
Lifecycle.LifecycleHandler, Lifecycle.LifecycleRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiates anAxonServerEventSchedulerusing the givenAxonServerEventScheduler.Builder. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiate a Builder to be able to create aAxonServerEventScheduler.voidcancelSchedule(ScheduleToken scheduleToken) Cancel a scheduled event.voidRegisters the activities to be executed in the various phases of an application's lifecycle.reschedule(ScheduleToken scheduleToken, Duration triggerDuration, Object event) Changes the trigger time for a scheduled event.Schedules an event to be published after a specified amount of time.Schedules an event to be published at a given moment.voidShuts down the Axon ServerEventSchedulerimplementation.voidstart()Start the Axon ServerEventSchedulerimplementation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.eventhandling.scheduling.EventScheduler
reschedule, shutdown
-
Constructor Details
-
AxonServerEventScheduler
Instantiates anAxonServerEventSchedulerusing the givenAxonServerEventScheduler.Builder.Will assert that the
SerializerandAxonServerConnectionManagerare notnulland will throw anAxonConfigurationExceptionif this is the case.- Parameters:
builder- theAxonServerEventScheduler.Builderused.
-
-
Method Details
-
builder
Instantiate a Builder to be able to create aAxonServerEventScheduler.The
requestTimeoutis defaulted to15000millis.The
SerializerandAxonServerConnectionManagerare hard requirements and as such should be provided.- Returns:
- a Builder to be able to create a
AxonServerEventScheduler
-
registerLifecycleHandlers
Description copied from interface:LifecycleRegisters the activities to be executed in the various phases of an application's lifecycle. This could either be at startup, shutdown, or both.- Specified by:
registerLifecycleHandlersin interfaceLifecycle- Parameters:
lifecycle- the lifecycle instance to register the handlers with- See Also:
-
start
public void start()Start the Axon ServerEventSchedulerimplementation. -
shutdownDispatching
public void shutdownDispatching()Shuts down the Axon ServerEventSchedulerimplementation. -
schedule
Schedules an event to be published at a given moment. The event is published in the application's default context.- Specified by:
schedulein interfaceEventScheduler- Parameters:
triggerDateTime- The moment to trigger publication of the eventevent- The event to publish- Returns:
- a token used to manage the schedule later
-
schedule
Schedules an event to be published after a specified amount of time.- Specified by:
schedulein interfaceEventScheduler- Parameters:
triggerDuration- the amount of time to wait before publishing the eventevent- the event to publish- Returns:
- a token used to manage the schedule later
-
cancelSchedule
Cancel a scheduled event.- Specified by:
cancelSchedulein interfaceEventScheduler- Parameters:
scheduleToken- the token returned when the event was scheduled
-
reschedule
public ScheduleToken reschedule(ScheduleToken scheduleToken, Duration triggerDuration, Object event) Changes the trigger time for a scheduled event.- Specified by:
reschedulein interfaceEventScheduler- Parameters:
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 publish- Returns:
- a token used to manage the schedule later
-