Package io.umadb.client
Record Class ReadRequest
java.lang.Object
java.lang.Record
io.umadb.client.ReadRequest
- Record Components:
query- optional filter for selecting specific event types or tags; may benullto read all eventsstart- optional sequence number to start reading from; must be >= 0 if providedbackwards- optional flag to read in reverse order; defaults tofalseif nulllimit- optional maximum number of events to return; must be > 0 if providedsubscribe- optional flag to keep the stream open; defaults tofalseif nullbatchSize- optional batch size hint for streaming responses; must be > 0 if provided
public record ReadRequest(Query query, Long start, Boolean backwards, Integer limit, Boolean subscribe, Integer batchSize)
extends Record
Represents a request to read events from the event store.
A ReadRequest can be sent to the Read RPC to retrieve events matching a Query.
Optional fields allow controlling the starting position, reading direction, maximum number of events,
subscription mode, and batch size.
Defaults:
backwardsdefaults tofalsesubscribedefaults tofalsestart,limit, andbatchSizeare optional
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ReadRequestall()Creates a minimalReadRequestselecting all events from the beginning.Returns the value of thebackwardsrecord component.Returns the value of thebatchSizerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.limit()Returns the value of thelimitrecord component.static ReadRequestCreates aReadRequestfor a specific query.query()Returns the value of thequeryrecord component.start()Returns the value of thestartrecord component.Returns the value of thesubscriberecord component.Returns a copy of this request with subscription enabled.final StringtoString()Returns a string representation of this record class.withDirection(boolean backwards) Returns a copy of this request with a specified read direction.withLimit(int limit) Returns a copy of this request with a specified limit.withStart(long start) Returns a copy of this request with a specified start position.
-
Constructor Details
-
ReadRequest
public ReadRequest(Query query, Long start, Boolean backwards, Integer limit, Boolean subscribe, Integer batchSize) Creates an instance of aReadRequestrecord class.- Parameters:
query- the value for thequeryrecord componentstart- the value for thestartrecord componentbackwards- the value for thebackwardsrecord componentlimit- the value for thelimitrecord componentsubscribe- the value for thesubscriberecord componentbatchSize- the value for thebatchSizerecord component
-
-
Method Details
-
all
Creates a minimalReadRequestselecting all events from the beginning.- Returns:
- a
ReadRequestwith default parameters
-
of
Creates aReadRequestfor a specific query.- Parameters:
query- the query to filter events; may benullto read all events- Returns:
- a
ReadRequestwith default parameters
-
subscribe
Returns a copy of this request with subscription enabled.- Parameters:
batchSize- optional batch size hint for streaming; may benull- Returns:
- a new
ReadRequestwith subscription enabled
-
withStart
Returns a copy of this request with a specified start position.- Parameters:
start- sequence number to start reading from- Returns:
- a new
ReadRequestwith the specified start
-
withDirection
Returns a copy of this request with a specified read direction.- Parameters:
backwards- true to read in reverse order- Returns:
- a new
ReadRequestwith the specified direction
-
withLimit
Returns a copy of this request with a specified limit.- Parameters:
limit- maximum number of events to return- Returns:
- a new
ReadRequestwith the specified limit
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
query
Returns the value of thequeryrecord component.- Returns:
- the value of the
queryrecord component
-
start
Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
backwards
Returns the value of thebackwardsrecord component.- Returns:
- the value of the
backwardsrecord component
-
limit
Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-
subscribe
Returns the value of thesubscriberecord component.- Returns:
- the value of the
subscriberecord component
-
batchSize
Returns the value of thebatchSizerecord component.- Returns:
- the value of the
batchSizerecord component
-