Record Class MessageStoreBatch
java.lang.Object
java.lang.Record
io.fluxzero.common.tracking.MessageStoreBatch
- Record Components:
messages- messages accepted by the scan filterlastScannedIndex- index of the last scanned source message, regardless of whether it matched the filterscannedSize- number of source messages scannedbyteLimited- whether scanning stopped because the next accepted message would exceed the byte budget
public record MessageStoreBatch(List<SerializedMessage> messages, Long lastScannedIndex, int scannedSize, boolean byteLimited)
extends Record
Result of scanning a message store for a tracking batch.
-
Constructor Summary
ConstructorsConstructorDescriptionMessageStoreBatch(List<SerializedMessage> messages, Long lastScannedIndex, int scannedSize, boolean byteLimited) Creates an instance of aMessageStoreBatchrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thebyteLimitedrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelastScannedIndexrecord component.messages()Returns the value of themessagesrecord component.static MessageStoreBatchscan(Iterable<SerializedMessage> source, int maxSize, long maxBytes, Predicate<? super SerializedMessage> filter) Scans source messages until the source count or accepted-message byte budget is exhausted.intReturns the value of thescannedSizerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MessageStoreBatch
public MessageStoreBatch(List<SerializedMessage> messages, Long lastScannedIndex, int scannedSize, boolean byteLimited) Creates an instance of aMessageStoreBatchrecord class.- Parameters:
messages- the value for themessagesrecord componentlastScannedIndex- the value for thelastScannedIndexrecord componentscannedSize- the value for thescannedSizerecord componentbyteLimited- the value for thebyteLimitedrecord component
-
-
Method Details
-
scan
public static MessageStoreBatch scan(Iterable<SerializedMessage> source, int maxSize, long maxBytes, Predicate<? super SerializedMessage> filter) Scans source messages until the source count or accepted-message byte budget is exhausted.The first accepted message is returned even when it exceeds
maxBytes, so consumers can keep making progress.- Parameters:
source- source messages in index ordermaxSize- maximum number of source messages to scanmaxBytes- maximum accepted-message payload bytes, or0for no byte limitfilter- predicate deciding which messages enter the returned batch- Returns:
- a batch with both accepted messages and source scan metadata
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
messages
-
lastScannedIndex
Returns the value of thelastScannedIndexrecord component.- Returns:
- the value of the
lastScannedIndexrecord component
-
scannedSize
public int scannedSize()Returns the value of thescannedSizerecord component.- Returns:
- the value of the
scannedSizerecord component
-
byteLimited
public boolean byteLimited()Returns the value of thebyteLimitedrecord component.- Returns:
- the value of the
byteLimitedrecord component
-