Class DocumentMessageReader
java.lang.Object
io.fluxzero.sdk.persisting.search.DocumentMessageReader
Retains the exact stored document source through serialization and handler interceptors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionread(List<io.fluxzero.common.api.SerializedMessage> messages, String topic, Serializer serializer) Reads one complete serializer batch, preserving per-document source metadata through upcasting.static DeserializingMessageretainSource(DeserializingMessage message, io.fluxzero.common.api.SerializedMessage source) Retains the original stored document bytes for metadata preservation after custom deserialization.static io.fluxzero.common.api.MetadatasourceMetadata(DeserializingMessage message) Returns metadata embedded in the handled document version, excluding the tracking envelope's time fields.
-
Constructor Details
-
DocumentMessageReader
public DocumentMessageReader()
-
-
Method Details
-
read
public Stream<DeserializingMessage> read(List<io.fluxzero.common.api.SerializedMessage> messages, String topic, Serializer serializer) Reads one complete serializer batch, preserving per-document source metadata through upcasting. -
retainSource
public static DeserializingMessage retainSource(DeserializingMessage message, io.fluxzero.common.api.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. Decoding is deferred until a replacement is actually needed. Non-document inputs have no stored metadata.
-