Interface SchedulingClient

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
InMemoryScheduleStore, LocalSchedulingClient, TestServerScheduleStore, WebsocketSchedulingClient

public interface SchedulingClient extends AutoCloseable
A lower-level client interface for scheduling and cancelling deferred messages (i.e., schedules) in Fluxzero.

This interface provides the primitives for scheduling logic used internally by MessageScheduler. It may interface with either:

  • The Fluxzero Runtime in runtime scenarios, where schedules are persisted in the MessageType.SCHEDULE log, or
  • An in-memory schedule store for testing scenarios, allowing fast and isolated feedback cycles.

Most application developers will not use this interface directly. Instead, they should rely on higher-level scheduling APIs such as MessageScheduler or static methods like Fluxzero.schedule(...).

A schedule represents a message that will be dispatched at a future time. The SerializedSchedule class encapsulates the serialized form of these scheduled messages.

See Also:
  • Method Details

    • schedule

      default CompletableFuture<Void> schedule(SerializedSchedule... schedules)
      Schedule one or more serialized schedules using Guarantee.SENT as the default delivery guarantee.
      Parameters:
      schedules - One or more schedules to add.
      Returns:
      A future that completes when the schedules have been sent or persisted (depending on the underlying implementation).
    • schedule

      CompletableFuture<Void> schedule(Guarantee guarantee, SerializedSchedule... schedules)
      Schedule one or more serialized schedules with a specified Guarantee.
      Parameters:
      guarantee - Delivery guarantee to apply (e.g., none, sent, stored).
      schedules - One or more schedules to register.
      Returns:
      A future that completes when the scheduling is acknowledged.
    • cancelSchedule

      default CompletableFuture<Void> cancelSchedule(String scheduleId)
      Cancel a scheduled message using Guarantee.SENT as the default guarantee.
      Parameters:
      scheduleId - The identifier of the schedule to cancel.
      Returns:
      A future that completes when the cancellation request is acknowledged.
    • cancelSchedule

      CompletableFuture<Void> cancelSchedule(String scheduleId, Guarantee guarantee)
      Cancel a scheduled message using the provided delivery guarantee.
      Parameters:
      scheduleId - The identifier of the schedule to cancel.
      guarantee - Delivery guarantee for the cancellation request.
      Returns:
      A future that completes when the cancellation is processed.
    • hasSchedule

      default boolean hasSchedule(String scheduleId)
      Checks whether a schedule with the given ID currently exists.
      Parameters:
      scheduleId - The identifier of the schedule to check.
      Returns:
      true if a schedule exists for the given ID, false otherwise.
    • getSchedule

      SerializedSchedule getSchedule(String scheduleId)
      Retrieves the serialized schedule associated with the given ID.
      Parameters:
      scheduleId - The ID of the schedule to retrieve.
      Returns:
      The matching SerializedSchedule, or null if none is found.
    • close

      void close()
      Closes this client and releases any underlying resources or tracking registrations.
      Specified by:
      close in interface AutoCloseable