Interface SchedulingClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemoryScheduleStore
,LocalSchedulingClient
,TestServerScheduleStore
,WebsocketSchedulingClient
A lower-level client interface for scheduling and cancelling deferred messages (i.e., schedules) in Flux Capacitor.
This interface provides the primitives for scheduling logic used internally by
MessageScheduler
. It may interface with either:
- The Flux Platform 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
FluxCapacitor.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.SENT
as the default guarantee.cancelSchedule
(String scheduleId, Guarantee guarantee) Cancel a scheduled message using the provided delivery guarantee.void
close()
Closes this client and releases any underlying resources or tracking registrations.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.default CompletableFuture
<Void> schedule
(SerializedSchedule... schedules) Schedule one or more serialized schedules usingGuarantee.SENT
as the default delivery guarantee.schedule
(Guarantee guarantee, SerializedSchedule... schedules) Schedule one or more serialized schedules with a specifiedGuarantee
.
-
Method Details
-
schedule
Schedule one or more serialized schedules usingGuarantee.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
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.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
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:
true
if a schedule exists for the given ID,false
otherwise.
-
getSchedule
Retrieves the serialized schedule associated with the given ID.- Parameters:
scheduleId
- The ID of the schedule to retrieve.- Returns:
- The matching
SerializedSchedule
, ornull
if none is found.
-
close
void close()Closes this client and releases any underlying resources or tracking registrations.- Specified by:
close
in interfaceAutoCloseable
-