T
- The type created by the keyed deserialization schema.@PublicEvolving public interface KafkaDeserializationSchema<T> extends Serializable, ResultTypeQueryable<T>
Modifier and Type | Method and Description |
---|---|
T |
deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> record)
Deserializes the Kafka record.
|
default void |
deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> message,
Collector<T> out)
Deserializes the Kafka record.
|
boolean |
isEndOfStream(T nextElement)
Method to decide whether the element signals the end of the stream.
|
default void |
open(DeserializationSchema.InitializationContext context)
Initialization method for the schema.
|
getProducedType
default void open(DeserializationSchema.InitializationContext context) throws Exception
deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[], byte[]>)
and thus suitable for one time setup work.
The provided DeserializationSchema.InitializationContext
can be used to access
additional features such as e.g. registering user metrics.
context
- Contextual information that can be used during initialization.Exception
boolean isEndOfStream(T nextElement)
nextElement
- The element to test for the end-of-stream signal.T deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> record) throws Exception
record
- Kafka record to be deserialized.Exception
default void deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> message, Collector<T> out) throws Exception
Can output multiple records through the Collector
. Note that number and size of
the produced records should be relatively small. Depending on the source implementation
records can be buffered in memory or collecting records might delay emitting checkpoint
barrier.
message
- The message, as a byte array.out
- The collector to put the resulting messages.Exception
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.