Class InMemoryScheduleStore
java.lang.Object
io.fluxcapacitor.javaclient.tracking.client.InMemoryMessageStore
io.fluxcapacitor.javaclient.scheduling.client.InMemoryScheduleStore
- All Implemented Interfaces:
Monitored<List<SerializedMessage>>
,HasMessageStore
,MessageStore
,SchedulingClient
,AutoCloseable
An in-memory implementation of a scheduling store that allows the scheduling, retrieval, and management of scheduled
messages. It extends `InMemoryMessageStore` to reuse the functionalities for storing and managing messages and
implements `SchedulingClient` to support scheduling-specific operations.
This implementation provides thread-safe mechanisms for scheduling, retrieving, and cancelling messages. Messages are scheduled to be processed at specific timestamps, with support for expiration and filtering of schedules.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend
(SerializedMessage... messages) Appends the given messages to the store.append
(List<SerializedMessage> messages) Appends a list of messages to the store.asList
(Map<Long, String> scheduleIdsByIndex, Serializer serializer) cancelSchedule
(String scheduleId, Guarantee guarantee) Cancel a scheduled message using the provided delivery guarantee.protected Collection
<SerializedMessage> filterMessages
(Collection<SerializedMessage> messages) getFutureSchedules
(Serializer serializer) getSchedule
(String scheduleId) Retrieves the serialized schedule associated with the given ID.protected void
purgeExpiredMessages
(Duration messageExpiration) removeExpiredSchedules
(Serializer serializer) schedule
(Guarantee guarantee, SerializedSchedule... schedules) Schedule one or more serialized schedules with a specifiedGuarantee
.void
toString()
Methods inherited from class io.fluxcapacitor.javaclient.tracking.client.InMemoryMessageStore
close, getBatch, getMessage, notifyMonitors, notifyMonitors, registerMonitor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.tracking.MessageStore
getBatch, getMessageStore, setRetentionTime, unwrap
Methods inherited from interface io.fluxcapacitor.javaclient.scheduling.client.SchedulingClient
cancelSchedule, close, hasSchedule, schedule
-
Constructor Details
-
InMemoryScheduleStore
public InMemoryScheduleStore() -
InMemoryScheduleStore
-
-
Method Details
-
filterMessages
- Overrides:
filterMessages
in classInMemoryMessageStore
-
append
Description copied from interface:MessageStore
Appends the given messages to the store.- Specified by:
append
in interfaceMessageStore
- Parameters:
messages
- messages to append- Returns:
- a
CompletableFuture
that completes when the messages have been successfully appended
-
schedule
Description copied from interface:SchedulingClient
Schedule one or more serialized schedules with a specifiedGuarantee
.- Specified by:
schedule
in interfaceSchedulingClient
- 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
Description copied from interface:SchedulingClient
Cancel a scheduled message using the provided delivery guarantee.- Specified by:
cancelSchedule
in interfaceSchedulingClient
- 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.
-
getSchedule
Description copied from interface:SchedulingClient
Retrieves the serialized schedule associated with the given ID.- Specified by:
getSchedule
in interfaceSchedulingClient
- Parameters:
scheduleId
- The ID of the schedule to retrieve.- Returns:
- The matching
SerializedSchedule
, ornull
if none is found.
-
append
Description copied from interface:MessageStore
Appends a list of messages to the store.- Specified by:
append
in interfaceMessageStore
- Overrides:
append
in classInMemoryMessageStore
- Parameters:
messages
- messages to append- Returns:
- a
CompletableFuture
that completes when the messages have been successfully appended
-
setClock
-
getFutureSchedules
-
removeExpiredSchedules
-
asList
-
purgeExpiredMessages
- Overrides:
purgeExpiredMessages
in classInMemoryMessageStore
-
toString
- Overrides:
toString
in classInMemoryMessageStore
-