Interface SchedulingClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemoryScheduleStore, LocalSchedulingClient, WebsocketSchedulingClient
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.SCHEDULElog, 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 TypeMethodDescriptiondefault CompletableFuture<Void> cancelSchedule(String scheduleId) Cancel a scheduled message usingGuarantee.SENTas the default guarantee.cancelSchedule(String scheduleId, io.fluxzero.common.Guarantee guarantee) Cancel a scheduled message using the provided delivery guarantee.voidclose()Closes this client and releases any underlying resources or tracking registrations.io.fluxzero.common.api.scheduling.SerializedSchedulegetSchedule(String scheduleId) Retrieves the serialized schedule associated with the given ID.default booleanhasSchedule(String scheduleId) Checks whether a schedule with the given ID currently exists.default CompletableFuture<Void> schedule(io.fluxzero.common.api.scheduling.SerializedSchedule... schedules) Schedule one or more serialized schedules usingGuarantee.SENTas 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 specifiedGuarantee.
-
Method Details
-
schedule
default CompletableFuture<Void> schedule(io.fluxzero.common.api.scheduling.SerializedSchedule... schedules) Schedule one or more serialized schedules usingGuarantee.SENTas 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 specifiedGuarantee.- 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
Cancel a scheduled message usingGuarantee.SENTas the default guarantee.- Parameters:
scheduleId- The identifier of the schedule to cancel.- Returns:
- A future that completes when the cancellation request is acknowledged.
-
cancelSchedule
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
Checks whether a schedule with the given ID currently exists.- Parameters:
scheduleId- The identifier of the schedule to check.- Returns:
trueif a schedule exists for the given ID,falseotherwise.
-
getSchedule
Retrieves the serialized schedule associated with the given ID.- Parameters:
scheduleId- The ID of the schedule to retrieve.- Returns:
- The matching
SerializedSchedule, ornullif none is found.
-
close
void close()Closes this client and releases any underlying resources or tracking registrations.- Specified by:
closein interfaceAutoCloseable
-