Class DocumentMessageReader
java.lang.Object
io.fluxzero.sdk.persisting.search.DocumentMessageReader
Internal, registration-scoped document reader. Retains the original composition for typed Graph handlers while
preserving the ordinary logical message, handler selection, payload parameters and interceptor input.
The root's upcast payload is reused; descendant paths and revisions always refer to the original composition.
Explicit internal Model-source handlers also require exactly one upcast state; ordinary document streams retain
split/drop semantics. Registrations are reference-counted and removed with their handlers.
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentMessageReader(Supplier<SearchClient> searchClient) Binds live Graph hydration to the owning client and consumer namespace. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisLiveGraph(DeserializingMessage message) Live compositions are observational and must never be persisted as a handler return side effect.read(List<SerializedMessage> messages, String topic, Serializer serializer) Reads a batch; topics without typed Graph handlers retain the original serializer stream.read(List<SerializedMessage> messages, String topic, Serializer serializer, SearchClient client) Reads using the explicit consumer namespace while retaining this reader's registration-scoped definitions.booleanreadsGraphs(String topic) Whether this collection needs the original composition alongside its logical document payload.booleanreadsModelDocuments(String topic) Whether this topic requires a single canonical Model state or the original Graph representation.register(Object target, HandlerFilter filter) Records accepted typed Graph and Model-source methods until the returned registration is cancelled.register(Object target, HandlerFilter filter, ModelRepository repository) Registers durable notifications in the same namespace as the document consumer.static DeserializingMessageretainSource(DeserializingMessage message, SerializedMessage source) Retains the original stored document bytes for metadata preservation after custom deserialization.static MetadatasourceMetadata(DeserializingMessage message) Returns metadata embedded in the handled document version, excluding the tracking envelope's time fields.
-
Constructor Details
-
DocumentMessageReader
public DocumentMessageReader() -
DocumentMessageReader
Binds live Graph hydration to the owning client and consumer namespace.
-
-
Method Details
-
register
Records accepted typed Graph and Model-source methods until the returned registration is cancelled. -
register
Registers durable notifications in the same namespace as the document consumer. -
readsGraphs
Whether this collection needs the original composition alongside its logical document payload. -
readsModelDocuments
Whether this topic requires a single canonical Model state or the original Graph representation. -
read
public Stream<DeserializingMessage> read(List<SerializedMessage> messages, String topic, Serializer serializer) Reads a batch; topics without typed Graph handlers retain the original serializer stream. -
read
public Stream<DeserializingMessage> read(List<SerializedMessage> messages, String topic, Serializer serializer, SearchClient client) Reads using the explicit consumer namespace while retaining this reader's registration-scoped definitions. -
retainSource
public static DeserializingMessage retainSource(DeserializingMessage message, SerializedMessage source) Retains the original stored document bytes for metadata preservation after custom deserialization. Use this when a customSerializer.deserializeMessages(Stream, MessageType, String)implementation constructs entirely new envelopes orDeserializingMessageinstances. Normal input-envelopewithData,withMetadataandwithSegmenttransformations already retain the source when invoked through this reader.Keep the original input before any transformation and attach it to each corresponding decoded output:
Keep this association explicitly when buffering, reordering or splitting a batch; message IDs alone are insufficient because multiple versions can share an ID. This method does not require changing the batch boundary. LaterDocumentMessageReader.retainSource(decodedOutput, originalInput);DeserializingMessage.withPayload(Object)replacements retain the attached context.The source must contain the exact stored version's original
Data.DOCUMENT_FORMATdata. Tracking envelope metadata and the upcast/replacement payload are not substitutes for those bytes. Metadata is read lazily only when needed; there is no storage fetch or lookup of a newer version. Arbitrary custom formats are not decoded by this helper.This attaches metadata provenance only: it does not copy the source message's ID, timestamps, revision or transport metadata into the output. A custom serializer remains responsible for preserving those ordinary message-envelope contracts.
- Parameters:
message- the corresponding custom-decoded outputsource- the unchanged original input document envelope- Returns:
- the supplied output with its source attached to the handling context
- See Also:
-
sourceMetadata
Returns metadata embedded in the handled document version, excluding the tracking envelope's time fields. Derived search exclusions and Model search summaries are regenerated by the replacement serializer. Decoding is deferred until a replacement is actually needed. Non-document inputs have no stored metadata. -
isLiveGraph
Live compositions are observational and must never be persisted as a handler return side effect.
-