Class PravegaDeserializationSchema<T>
- java.lang.Object
-
- io.pravega.connectors.flink.serialization.PravegaDeserializationSchema<T>
-
- All Implemented Interfaces:
WrappingSerializer<T>
,java.io.Serializable
,org.apache.flink.api.common.serialization.DeserializationSchema<T>
,org.apache.flink.api.java.typeutils.ResultTypeQueryable<T>
public class PravegaDeserializationSchema<T> extends java.lang.Object implements org.apache.flink.api.common.serialization.DeserializationSchema<T>, WrappingSerializer<T>
A deserialization schema adapter for a Pravega serializer.This adapter exposes the Pravega serializer as a Flink Deserialization schema and exposes the produced type (TypeInformation) to allow Flink to configure its internal serialization and persistence stack.
To deserialize metadata, use
PravegaDeserializationSchemaWithMetadata
instead.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PravegaDeserializationSchema(java.lang.Class<T> typeClass, io.pravega.client.stream.Serializer<T> serializer)
Creates a new PravegaDeserializationSchema using the given Pravega serializer, and the type described by the type class.PravegaDeserializationSchema(org.apache.flink.api.common.typeinfo.TypeHint<T> typeHint, io.pravega.client.stream.Serializer<T> serializer)
Creates a new PravegaDeserializationSchema using the given Pravega serializer, and the type described by the type hint.PravegaDeserializationSchema(org.apache.flink.api.common.typeinfo.TypeInformation<T> typeInfo, io.pravega.client.stream.Serializer<T> serializer)
Creates a new PravegaDeserializationSchema using the given Pravega serializer, and the given TypeInformation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
deserialize(byte[] message)
org.apache.flink.api.common.typeinfo.TypeInformation<T>
getProducedType()
io.pravega.client.stream.Serializer<T>
getWrappedSerializer()
Gets the wrapped Pravega Serializer.boolean
isEndOfStream(T nextElement)
-
-
-
Constructor Detail
-
PravegaDeserializationSchema
public PravegaDeserializationSchema(java.lang.Class<T> typeClass, io.pravega.client.stream.Serializer<T> serializer)
Creates a new PravegaDeserializationSchema using the given Pravega serializer, and the type described by the type class.Use this constructor if the produced type is not generic and can be fully described by a class. If the type is generic, use the
PravegaDeserializationSchema(TypeHint, Serializer)
constructor instead.- Parameters:
typeClass
- The class describing the deserialized type.serializer
- The serializer to deserialize the byte messages.
-
PravegaDeserializationSchema
public PravegaDeserializationSchema(org.apache.flink.api.common.typeinfo.TypeHint<T> typeHint, io.pravega.client.stream.Serializer<T> serializer)
Creates a new PravegaDeserializationSchema using the given Pravega serializer, and the type described by the type hint.Use this constructor if the produced type is generic and cannot be fully described by a class alone. The type hint instantiation captures generic type information to make it available at runtime.
DeserializationSchema<Tuple2<String, String>> schema = new PravegaDeserializationSchema<>(new TypeHint<Tuple2<String, String>>(){}, serializer);
- Parameters:
typeHint
- The Type Hint describing the deserialized type.serializer
- The serializer to deserialize the byte messages.
-
PravegaDeserializationSchema
public PravegaDeserializationSchema(org.apache.flink.api.common.typeinfo.TypeInformation<T> typeInfo, io.pravega.client.stream.Serializer<T> serializer)
Creates a new PravegaDeserializationSchema using the given Pravega serializer, and the given TypeInformation.- Parameters:
typeInfo
- The TypeInformation describing the deserialized type.serializer
- The serializer to deserialize the byte messages.
-
-
Method Detail
-
deserialize
public T deserialize(byte[] message) throws java.io.IOException
- Specified by:
deserialize
in interfaceorg.apache.flink.api.common.serialization.DeserializationSchema<T>
- Throws:
java.io.IOException
-
isEndOfStream
public boolean isEndOfStream(T nextElement)
- Specified by:
isEndOfStream
in interfaceorg.apache.flink.api.common.serialization.DeserializationSchema<T>
-
getProducedType
public org.apache.flink.api.common.typeinfo.TypeInformation<T> getProducedType()
- Specified by:
getProducedType
in interfaceorg.apache.flink.api.java.typeutils.ResultTypeQueryable<T>
-
getWrappedSerializer
public io.pravega.client.stream.Serializer<T> getWrappedSerializer()
Description copied from interface:WrappingSerializer
Gets the wrapped Pravega Serializer.- Specified by:
getWrappedSerializer
in interfaceWrappingSerializer<T>
- Returns:
- a Pravega
Serializer
.
-
-