Class TestServerScheduleStore
java.lang.Object
io.fluxzero.testserver.scheduling.TestServerScheduleStore
- All Implemented Interfaces:
Monitored<List<SerializedMessage>>, HasMessageStore, MessageStore, SchedulingClient, AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves a batch of messages starting from the givenlastIndex(exclusive).Retrieves a batch of messages starting from the givenminIndex.protected voidrescheduleNextDeadline(long nextIndex) scanBatch(Long minIndex, int maxSize, boolean inclusive, long maxBytes, Predicate<? super SerializedMessage> filter) Scans messages starting from the givenminIndex, returning messages accepted byfilterand metadata about the unfiltered source scan.schedule(Guarantee guarantee, SerializedSchedule... schedules) Schedule one or more serialized schedules with a specifiedGuarantee.voidtruncate()Removes all messages from this store while keeping the logical log available for future appends.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MessageStore
append, append, close, getBatch, getBatch, getMessageStore, setRetentionTime, unwrapMethods inherited from interface Monitored
registerMonitorMethods inherited from interface SchedulingClient
cancelSchedule, cancelSchedule, close, getSchedule, hasSchedule, schedule
-
Constructor Details
-
TestServerScheduleStore
-
-
Method Details
-
schedule
Description copied from interface:SchedulingClientSchedule one or more serialized schedules with a specifiedGuarantee.- Specified by:
schedulein 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.
-
getBatch
Description copied from interface:MessageStoreRetrieves a batch of messages starting from the givenlastIndex(exclusive).- Specified by:
getBatchin interfaceMessageStore- Parameters:
minIndex- minimum message index to start from (exclusive)maxSize- maximum number of messages to retrieve- Returns:
- a list of
SerializedMessageinstances
-
getBatch
Description copied from interface:MessageStoreRetrieves a batch of messages starting from the givenminIndex.- Specified by:
getBatchin interfaceMessageStore- Parameters:
minIndex- minimum message index to start frommaxSize- maximum number of messages to retrieveinclusive- whether to include the message atminIndex- Returns:
- a list of
SerializedMessageinstances
-
scanBatch
public MessageStoreBatch scanBatch(Long minIndex, int maxSize, boolean inclusive, long maxBytes, Predicate<? super SerializedMessage> filter) Description copied from interface:MessageStoreScans messages starting from the givenminIndex, returning messages accepted byfilterand metadata about the unfiltered source scan.maxSizelimits the number of source messages scanned.maxByteslimits the cumulative serialized payload bytes of accepted messages. If the first accepted message is larger thanmaxBytes, it is still returned so consumers can make progress.- Specified by:
scanBatchin interfaceMessageStore- Parameters:
minIndex- minimum message index to start frommaxSize- maximum number of source messages to scaninclusive- whether to include the message atminIndexmaxBytes- maximum number of accepted serialized payload bytes, or0for no byte limitfilter- predicate deciding which messages enter the returned batch- Returns:
- accepted messages and source scan metadata
-
rescheduleNextDeadline
protected void rescheduleNextDeadline(long nextIndex) -
truncate
public void truncate()Description copied from interface:MessageStoreRemoves all messages from this store while keeping the logical log available for future appends.- Specified by:
truncatein interfaceMessageStore
-