Class PubSubPositionDeserializer
PubSubPositionWireFormat
data into concrete PubSubPosition
instances using a configured PubSubPositionTypeRegistry
.
This class offers static access to a default deserializer instance backed by the reserved registry. In most production cases, callers are encouraged to instantiate their own deserializer with a custom registry instead of relying on the default static entry point.
Deserialization involves reading the type ID from the wire format and delegating to the corresponding
PubSubPositionFactory
to produce the appropriate position implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PubSubPositionDeserializer
Note: The following default instance is only for convenience purposes until we've updated all the code to use pass the registry and resolver explicitly. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PubSubPosition
deserializePubSubPosition
(byte[] positionWireBytes, String factoryClassName) static PubSubPosition
deserializePubSubPosition
(PubSubPositionWireFormat wireFormat, String factoryClassName) static PubSubPosition
deserializePubSubPosition
(ByteBuffer positionWireBytes, String factoryClassName) Deserializes aPubSubPosition
using the provided wire format bytes and factory class name.static PubSubPositionWireFormat
deserializeWireFormat
(byte[] positionWireFormatBytes) static PubSubPositionWireFormat
deserializeWireFormat
(ByteBuffer positionWireFormatBytes) Deserializes aPubSubPositionWireFormat
from aByteBuffer
.static PubSubPosition
getPositionFromWireFormat
(byte[] positionWireFormatBytes) Convenience method for converting a serialized byte array representing aPubSubPositionWireFormat
into a concretePubSubPosition
instance.static PubSubPosition
getPositionFromWireFormat
(PubSubPositionWireFormat positionWireFormat) Convenience method for converting aPubSubPositionWireFormat
record into a concretePubSubPosition
.static PubSubPosition
getPositionFromWireFormat
(ByteBuffer positionWireFormatBuffer) toPosition
(byte[] positionWireFormatBytes) toPosition
(PubSubPositionWireFormat positionWireFormat) Converts a wire format position to a PubSubPositiontoPosition
(ByteBuffer positionWireFormatBytes)
-
Field Details
-
DEFAULT_DESERIALIZER
Note: The following default instance is only for convenience purposes until we've updated all the code to use pass the registry and resolver explicitly.
-
-
Constructor Details
-
PubSubPositionDeserializer
-
-
Method Details
-
toPosition
Converts a wire format position to a PubSubPosition- Parameters:
positionWireFormat
- the wire format position- Returns:
- concrete position object represented by the wire format
-
toPosition
-
toPosition
-
getPositionFromWireFormat
Convenience method for converting a serialized byte array representing aPubSubPositionWireFormat
into a concretePubSubPosition
instance.This uses the
DEFAULT_DESERIALIZER
with the reserved position type registry. Recommended only for use in non-critical paths or tests where custom registries are not required.- Parameters:
positionWireFormatBytes
- the serialized bytes ofPubSubPositionWireFormat
- Returns:
- deserialized
PubSubPosition
object - Throws:
VeniceException
- if deserialization fails or type ID is unrecognized
-
getPositionFromWireFormat
-
getPositionFromWireFormat
Convenience method for converting aPubSubPositionWireFormat
record into a concretePubSubPosition
.This uses the
DEFAULT_DESERIALIZER
with the reserved position type registry. Prefer constructing your ownPubSubPositionDeserializer
with a custom registry if needed.- Parameters:
positionWireFormat
- the wire format record to convert- Returns:
- deserialized
PubSubPosition
object - Throws:
VeniceException
- if the type ID in the wire format is unrecognized
-
deserializePubSubPosition
public static PubSubPosition deserializePubSubPosition(ByteBuffer positionWireBytes, String factoryClassName) Deserializes aPubSubPosition
using the provided wire format bytes and factory class name.This helper is intended for use cases where the factory class name is explicitly stored alongside the position wire format bytes, such as in repush checkpoints or change capture consumers.
It should not be used in Venice servers or controllers where position deserialization is handled via
PubSubPositionDeserializer
andPubSubPositionTypeRegistry
based on type IDs.- Parameters:
positionWireBytes
- the serialized wire format bytes in aByteBuffer
factoryClassName
- the fully-qualified class name of the factory used to deserialize the position- Returns:
- the deserialized
PubSubPosition
- Throws:
RuntimeException
- if deserialization or factory instantiation fails
-
deserializePubSubPosition
public static PubSubPosition deserializePubSubPosition(byte[] positionWireBytes, String factoryClassName) -
deserializePubSubPosition
public static PubSubPosition deserializePubSubPosition(PubSubPositionWireFormat wireFormat, String factoryClassName) -
deserializeWireFormat
Deserializes aPubSubPositionWireFormat
from aByteBuffer
.This method extracts a byte array from the given
ByteBuffer
and usesPubSubPosition.PUBSUB_POSITION_WIRE_FORMAT_SERIALIZER
} to decode it into aPubSubPositionWireFormat
instance.This is typically used when reconstructing position metadata stored in serialized wire format, such as in checkpointing, audit logs, or administrative tooling.
- Parameters:
positionWireFormatBytes
- the wire format bytes wrapped in aByteBuffer
- Returns:
- the deserialized
PubSubPositionWireFormat
- Throws:
RuntimeException
- if deserialization fails
-
deserializeWireFormat
-