public final class CanalJsonDeserializationSchema extends Object implements DeserializationSchema<RowData>
RowData
. The deserialization schema knows Canal's schema definition and can extract the database
data and convert into RowData
with RowKind
.
Deserializes a byte[]
message as a JSON object and reads the specified fields.
Failures during deserialization are forwarded as wrapped IOExceptions.
Modifier and Type | Class and Description |
---|---|
static class |
CanalJsonDeserializationSchema.Builder
A builder for creating a
CanalJsonDeserializationSchema . |
DeserializationSchema.InitializationContext
Modifier and Type | Method and Description |
---|---|
static CanalJsonDeserializationSchema.Builder |
builder(DataType physicalDataType,
List<org.apache.flink.formats.json.canal.CanalJsonDecodingFormat.ReadableMetadata> requestedMetadata,
TypeInformation<RowData> producedTypeInfo)
Creates A builder for building a
CanalJsonDeserializationSchema . |
RowData |
deserialize(byte[] message)
Deserializes the byte message.
|
void |
deserialize(byte[] message,
Collector<RowData> out)
Deserializes the byte message.
|
boolean |
equals(Object o) |
TypeInformation<RowData> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
int |
hashCode() |
boolean |
isEndOfStream(RowData nextElement)
Method to decide whether the element signals the end of the stream.
|
void |
open(DeserializationSchema.InitializationContext context)
Initialization method for the schema.
|
public static CanalJsonDeserializationSchema.Builder builder(DataType physicalDataType, List<org.apache.flink.formats.json.canal.CanalJsonDecodingFormat.ReadableMetadata> requestedMetadata, TypeInformation<RowData> producedTypeInfo)
CanalJsonDeserializationSchema
.public void open(DeserializationSchema.InitializationContext context) throws Exception
DeserializationSchema
DeserializationSchema.deserialize(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 DeserializationSchema<RowData>
context
- Contextual information that can be used during initialization.Exception
public RowData deserialize(byte[] message) throws IOException
DeserializationSchema
deserialize
in interface DeserializationSchema<RowData>
message
- The message, as a byte array.IOException
public void deserialize(@Nullable byte[] message, Collector<RowData> out) throws IOException
DeserializationSchema
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.
deserialize
in interface DeserializationSchema<RowData>
message
- The message, as a byte array.out
- The collector to put the resulting messages.IOException
public boolean isEndOfStream(RowData nextElement)
DeserializationSchema
isEndOfStream
in interface DeserializationSchema<RowData>
nextElement
- The element to test for the end-of-stream signal.public TypeInformation<RowData> getProducedType()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<RowData>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.