Class AxonServerEventScheduler

java.lang.Object
org.axonframework.axonserver.connector.event.axon.AxonServerEventScheduler
All Implemented Interfaces:
org.axonframework.eventhandling.scheduling.EventScheduler, org.axonframework.lifecycle.Lifecycle

public class AxonServerEventScheduler extends Object implements org.axonframework.eventhandling.scheduling.EventScheduler, org.axonframework.lifecycle.Lifecycle
Implementation of the EventScheduler that uses Axon Server to schedule the events.
Since:
4.4
Author:
Marc Gathier
  • Constructor Details

  • Method Details

    • builder

      public static AxonServerEventScheduler.Builder builder()
      Instantiate a Builder to be able to create a AxonServerEventScheduler.

      The requestTimeout is defaulted to 15000 millis.

      The Serializer and AxonServerConnectionManager are hard requirements and as such should be provided.

      Returns:
      a Builder to be able to create a AxonServerEventScheduler
    • registerLifecycleHandlers

      public void registerLifecycleHandlers(@Nonnull org.axonframework.lifecycle.Lifecycle.LifecycleRegistry lifecycle)
      Specified by:
      registerLifecycleHandlers in interface org.axonframework.lifecycle.Lifecycle
    • start

      public void start()
      Start the Axon Server EventScheduler implementation.
    • shutdownDispatching

      public void shutdownDispatching()
      Shuts down the Axon Server EventScheduler implementation.
    • schedule

      public org.axonframework.eventhandling.scheduling.ScheduleToken schedule(Instant triggerDateTime, Object event)
      Schedules an event to be published at a given moment. The event is published in the application's default context.
      Specified by:
      schedule in interface org.axonframework.eventhandling.scheduling.EventScheduler
      Parameters:
      triggerDateTime - The moment to trigger publication of the event
      event - The event to publish
      Returns:
      a token used to manage the schedule later
    • schedule

      public org.axonframework.eventhandling.scheduling.ScheduleToken schedule(Duration triggerDuration, Object event)
      Schedules an event to be published after a specified amount of time.
      Specified by:
      schedule in interface org.axonframework.eventhandling.scheduling.EventScheduler
      Parameters:
      triggerDuration - the amount of time to wait before publishing the event
      event - the event to publish
      Returns:
      a token used to manage the schedule later
    • cancelSchedule

      public void cancelSchedule(org.axonframework.eventhandling.scheduling.ScheduleToken scheduleToken)
      Cancel a scheduled event.
      Specified by:
      cancelSchedule in interface org.axonframework.eventhandling.scheduling.EventScheduler
      Parameters:
      scheduleToken - the token returned when the event was scheduled
    • reschedule

      public org.axonframework.eventhandling.scheduling.ScheduleToken reschedule(org.axonframework.eventhandling.scheduling.ScheduleToken scheduleToken, Duration triggerDuration, Object event)
      Changes the trigger time for a scheduled event.
      Specified by:
      reschedule in interface org.axonframework.eventhandling.scheduling.EventScheduler
      Parameters:
      scheduleToken - the token returned when the event was scheduled, might be null
      triggerDuration - the amount of time to wait before publishing the event
      event - the event to publish
      Returns:
      a token used to manage the schedule later