@PublicEvolving public class JSONKeyValueDeserializationSchema extends Object implements KafkaDeserializationSchema<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode>
Key fields can be accessed by calling objectNode.get("key").get(<name>).as(<type>)
Value fields can be accessed by calling objectNode.get("value").get(<name>).as(<type>)
Metadata fields can be accessed by calling objectNode.get("metadata").get(<name>).as(<type>) and include the "offset" (long), "topic" (String) and "partition" (int).
Constructor and Description |
---|
JSONKeyValueDeserializationSchema(boolean includeMetadata) |
Modifier and Type | Method and Description |
---|---|
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode |
deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> record)
Deserializes the Kafka record.
|
TypeInformation<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
boolean |
isEndOfStream(org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode nextElement)
Method to decide whether the element signals the end of the stream.
|
void |
open(DeserializationSchema.InitializationContext context)
Initialization method for the schema.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deserialize
public JSONKeyValueDeserializationSchema(boolean includeMetadata)
public void open(DeserializationSchema.InitializationContext context) throws Exception
KafkaDeserializationSchema
KafkaDeserializationSchema.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.
open
in interface KafkaDeserializationSchema<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode>
context
- Contextual information that can be used during initialization.Exception
public org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode deserialize(org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> record) throws Exception
KafkaDeserializationSchema
deserialize
in interface KafkaDeserializationSchema<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode>
record
- Kafka record to be deserialized.Exception
public boolean isEndOfStream(org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode nextElement)
KafkaDeserializationSchema
isEndOfStream
in interface KafkaDeserializationSchema<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode>
nextElement
- The element to test for the end-of-stream signal.public TypeInformation<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode> getProducedType()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.