Interface SchedulingClient

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
InMemoryScheduleStore, LocalSchedulingClient, 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 Summary

    Modifier and Type
    Method
    Description
    Acquires opaque namespace-local lifetime bindings to existing parents.
    cancelSchedule(String scheduleId)
    Cancel a scheduled message using Guarantee.DEFAULT as the default guarantee.
    cancelSchedule(String scheduleId, io.fluxzero.common.Guarantee guarantee)
    Cancel a scheduled message using the provided delivery guarantee.
    void
    Closes this client and releases any underlying resources or tracking registrations.
    io.fluxzero.common.api.scheduling.SerializedSchedule
    getSchedule(String scheduleId)
    Retrieves the serialized schedule associated with the given ID.
    default boolean
    hasSchedule(String scheduleId)
    Checks whether a schedule with the given ID currently exists.
    schedule(io.fluxzero.common.api.scheduling.SerializedSchedule... schedules)
    Schedule one or more serialized schedules using Guarantee.DEFAULT as the default delivery guarantee.
    schedule(io.fluxzero.common.Guarantee guarantee, io.fluxzero.common.api.scheduling.SerializedSchedule... schedules)
    Schedule one or more serialized schedules with a specified Guarantee.
    scheduleBoundToParents(io.fluxzero.common.Guarantee guarantee, Map<String,Long> parents, io.fluxzero.common.api.scheduling.SerializedSchedule... schedules)
    Stores schedules with previously acquired bindings, without rebinding recreated parents.
    scheduleWithParents(io.fluxzero.common.Guarantee guarantee, List<String> parentIds, io.fluxzero.common.api.scheduling.SerializedSchedule... schedules)
    Schedules messages owned by the current lifetime of each committed Model parent.
  • Method Details

    • schedule

      default CompletableFuture<Void> schedule(io.fluxzero.common.api.scheduling.SerializedSchedule... schedules)
      Schedule one or more serialized schedules using Guarantee.DEFAULT 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(io.fluxzero.common.Guarantee guarantee, io.fluxzero.common.api.scheduling.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 selected delivery guarantee is reached.
    • scheduleWithParents

      default CompletableFuture<Void> scheduleWithParents(io.fluxzero.common.Guarantee guarantee, List<String> parentIds, io.fluxzero.common.api.scheduling.SerializedSchedule... schedules)
      Schedules messages owned by the current lifetime of each committed Model parent. Any parent deletion triggers asynchronous cancellation. Empty parents use ordinary scheduling. Custom clients must explicitly implement ownership; it is never silently ignored.
      Parameters:
      guarantee - acknowledgement guarantee
      parentIds - canonical Model IDs in this client's namespace
      schedules - messages to register
      Returns:
      acknowledgement of scheduling, or an unsupported-operation failure
    • bindScheduleParents

      default CompletableFuture<Map<String,Long>> bindScheduleParents(List<String> parentIds)
      Acquires opaque namespace-local lifetime bindings to existing parents.
    • scheduleBoundToParents

      default CompletableFuture<Void> scheduleBoundToParents(io.fluxzero.common.Guarantee guarantee, Map<String,Long> parents, io.fluxzero.common.api.scheduling.SerializedSchedule... schedules)
      Stores schedules with previously acquired bindings, without rebinding recreated parents.
    • cancelSchedule

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

      CompletableFuture<Void> cancelSchedule(String scheduleId, io.fluxzero.common.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 selected delivery guarantee is reached.
    • 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

      io.fluxzero.common.api.scheduling.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