Class DefaultMessageScheduler

java.lang.Object
io.fluxcapacitor.javaclient.scheduling.DefaultMessageScheduler
All Implemented Interfaces:
MessageScheduler, HasLocalHandlers

public class DefaultMessageScheduler extends Object implements MessageScheduler, HasLocalHandlers
Default implementation of the MessageScheduler interface.

This implementation uses a SchedulingClient to schedule and cancel scheduled messages, and implements the HasLocalHandlers interface to allow for local handling of scheduled messages, used by TestFixtures.

  • Constructor Details

    • DefaultMessageScheduler

      public DefaultMessageScheduler()
  • Method Details

    • schedule

      public CompletableFuture<Void> schedule(Schedule message, boolean ifAbsent, Guarantee guarantee)
      Description copied from interface: MessageScheduler
      Schedule the given Schedule object, optionally skipping if already present, using the specified guarantee.
      Specified by:
      schedule in interface MessageScheduler
      Parameters:
      message - the schedule message
      ifAbsent - only schedule if not already scheduled
      guarantee - the delivery guarantee to use
      Returns:
      a CompletableFuture completing when the message is successfully scheduled
    • scheduleCommand

      public CompletableFuture<Void> scheduleCommand(Schedule schedule, boolean ifAbsent, Guarantee guarantee)
      Description copied from interface: MessageScheduler
      Schedule a command using the given scheduling settings, using the provided Guarantee.
      Specified by:
      scheduleCommand in interface MessageScheduler
      Parameters:
      schedule - the command schedule
      ifAbsent - skip if existing schedule is present
      guarantee - the delivery guarantee to apply
      Returns:
      a future indicating when the command is scheduled
    • cancelSchedule

      public void cancelSchedule(String scheduleId)
      Description copied from interface: MessageScheduler
      Cancel a previously scheduled message or command by ID.
      Specified by:
      cancelSchedule in interface MessageScheduler
      Parameters:
      scheduleId - the ID of the schedule to cancel
    • getSchedule

      public Optional<Schedule> getSchedule(String scheduleId)
      Description copied from interface: MessageScheduler
      Look up an existing schedule.
      Specified by:
      getSchedule in interface MessageScheduler
      Parameters:
      scheduleId - the ID of the schedule
      Returns:
      the schedule if found
    • handleLocally

      public void handleLocally(Schedule schedule)