T
- The output message type for sinking to downstream flink operator.@PublicEvolving public interface PulsarDeserializationSchema<T> extends Serializable, ResultTypeQueryable<T>
Message<byte[]>
into a flink managed
instance. We support both the pulsar's self managed schema and flink managed schema.Modifier and Type | Method and Description |
---|---|
void |
deserialize(org.apache.pulsar.client.api.Message<byte[]> message,
Collector<T> out)
Deserializes the pulsar message.
|
static <T> PulsarDeserializationSchema<T> |
flinkSchema(DeserializationSchema<T> deserializationSchema)
Create a PulsarDeserializationSchema by using the flink's
DeserializationSchema . |
static <T> PulsarDeserializationSchema<T> |
flinkTypeInfo(TypeInformation<T> information,
ExecutionConfig config)
Create a PulsarDeserializationSchema by using the given
TypeInformation . |
default void |
open(DeserializationSchema.InitializationContext context)
Initialization method for the schema.
|
static <K,V> PulsarDeserializationSchema<org.apache.pulsar.common.schema.KeyValue<K,V>> |
pulsarSchema(org.apache.pulsar.client.api.Schema<org.apache.pulsar.common.schema.KeyValue<K,V>> schema,
Class<K> keyClass,
Class<V> valueClass)
Create a PulsarDeserializationSchema by using the Pulsar
Schema instance. |
static <T> PulsarDeserializationSchema<T> |
pulsarSchema(org.apache.pulsar.client.api.Schema<T> schema)
Create a PulsarDeserializationSchema by using the Pulsar
Schema instance. |
static <T> PulsarDeserializationSchema<T> |
pulsarSchema(org.apache.pulsar.client.api.Schema<T> schema,
Class<T> typeClass)
Create a PulsarDeserializationSchema by using the Pulsar
Schema instance. |
getProducedType
default void open(DeserializationSchema.InitializationContext context) throws Exception
deserialize(org.apache.pulsar.client.api.Message<byte[]>, org.apache.flink.util.Collector<T>)
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
void deserialize(org.apache.pulsar.client.api.Message<byte[]> message, Collector<T> out) throws Exception
You can output multiple message by using 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 decoded by pulsar.out
- The collector to put the resulting messages.Exception
static <T> PulsarDeserializationSchema<T> flinkSchema(DeserializationSchema<T> deserializationSchema)
DeserializationSchema
. It
would consume the pulsar message as byte array and decode the message by using flink's logic.static <T> PulsarDeserializationSchema<T> pulsarSchema(org.apache.pulsar.client.api.Schema<T> schema)
Schema
instance. The message
bytes must be encoded by pulsar Schema.
We only support primitive types here.
static <T> PulsarDeserializationSchema<T> pulsarSchema(org.apache.pulsar.client.api.Schema<T> schema, Class<T> typeClass)
Schema
instance. The message
bytes must be encoded by pulsar Schema.
We only support struct types here.
static <K,V> PulsarDeserializationSchema<org.apache.pulsar.common.schema.KeyValue<K,V>> pulsarSchema(org.apache.pulsar.client.api.Schema<org.apache.pulsar.common.schema.KeyValue<K,V>> schema, Class<K> keyClass, Class<V> valueClass)
Schema
instance. The message
bytes must be encoded by pulsar Schema.
We only support keyvalue types here.
static <T> PulsarDeserializationSchema<T> flinkTypeInfo(TypeInformation<T> information, ExecutionConfig config)
TypeInformation
. This method
is only used for treating message that was written into pulsar by TypeInformation
.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.