Class PubSubMessageDeserializer
PubSubMessage-
Constructor Summary
ConstructorsConstructorDescriptionPubSubMessageDeserializer(KafkaValueSerializer valueSerializer, ObjectPool<KafkaMessageEnvelope> putEnvelopePool, ObjectPool<KafkaMessageEnvelope> updateEnvelopePool) PubSubMessageDeserializer(KafkaValueSerializer valueSerializer, ObjectPool<KafkaMessageEnvelope> putEnvelopePool, ObjectPool<KafkaMessageEnvelope> updateEnvelopePool, boolean producerTimestampFallbackEnabled) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static PubSubMessageDeserializerDo not use the following default deserializer in production code as it does not support schema evolution properly.static PubSubMessageDeserializerDo not use the following default deserializer in production code as it does not support schema evolution properly.deserialize(PubSubTopicPartition topicPartition, byte[] keyBytes, byte[] valueBytes, PubSubMessageHeaders headers, PubSubPosition pubSubPosition, Long timestamp) Deserialize a message from the pubsub specific message format to PubSubMessage.
-
Constructor Details
-
PubSubMessageDeserializer
public PubSubMessageDeserializer(KafkaValueSerializer valueSerializer, ObjectPool<KafkaMessageEnvelope> putEnvelopePool, ObjectPool<KafkaMessageEnvelope> updateEnvelopePool) -
PubSubMessageDeserializer
public PubSubMessageDeserializer(KafkaValueSerializer valueSerializer, ObjectPool<KafkaMessageEnvelope> putEnvelopePool, ObjectPool<KafkaMessageEnvelope> updateEnvelopePool, boolean producerTimestampFallbackEnabled)
-
-
Method Details
-
deserialize
public DefaultPubSubMessage deserialize(PubSubTopicPartition topicPartition, byte[] keyBytes, byte[] valueBytes, PubSubMessageHeaders headers, PubSubPosition pubSubPosition, Long timestamp) Deserialize a message from the pubsub specific message format to PubSubMessage.Side effect on
headers: if the input containsPubSubMessageHeaders.VENICE_TRANSPORT_PROTOCOL_HEADER, this method strips it viaPubSubMessageHeaders.stripProtocolSchemaHeader(com.linkedin.venice.pubsub.api.PubSubMessageHeaders)— best-effort in-place when the headers object is mutable, copy-fallback otherwise. The header carries the entire ~16 KB Avro JSON forKafkaMessageEnvelopeand is dead weight once the value envelope is built; pinning it per queued record has been observed to cost upwards of 10 GB on the DaVinci buffer queue during back-pressure. Callers that need to retainvtpafter this call must pass a copy. Callers whoseheadersreference is shared across reads should pre-strip viaPubSubMessageHeaders.stripProtocolSchemaHeaderCopy(com.linkedin.venice.pubsub.api.PubSubMessageHeaders)themselves.- Parameters:
topicPartition- the topic partition from which the message was readkeyBytes- the key bytes of the messagevalueBytes- the value bytes of the messageheaders- the headers of the message; may be modified in place to removePubSubMessageHeaders.VENICE_TRANSPORT_PROTOCOL_HEADERpubSubPosition- the position of the message in the topic partitiontimestamp- the timestamp of the message- Returns:
- the deserialized PubSubMessage
-
close
public void close() -
getValueSerializer
-
createDefaultDeserializer
Do not use the following default deserializer in production code as it does not support schema evolution properly. It is only provided for convenience in test code. -
createOptimizedDeserializer
Do not use the following default deserializer in production code as it does not support schema evolution properly. It is only provided for convenience in test code.
-