public class PulsarSerializationSchemaWrapper<T> extends Object implements PulsarSerializationSchema<T>, PulsarContextAware<T>
SerializationSchema to PulsarSerializationSchema.| Modifier and Type | Class and Description |
|---|---|
static class |
PulsarSerializationSchemaWrapper.Builder<T>
Builder for
PulsarSerializationSchemaWrapper. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getKey(T element) |
org.apache.pulsar.client.api.Schema<?> |
getPulsarSchema() |
String |
getTargetTopic(T element)
Returns the topic that the presented element should be sent to.
|
void |
open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context)
Initialization method for the schema.
|
byte[] |
serialize(T element)
Serializes given element and returns it as a byte[].
|
void |
serialize(T element,
org.apache.pulsar.client.api.TypedMessageBuilder<byte[]> messageBuilder) |
void |
setNumParallelInstances(int numParallelInstances)
Sets the parallelism with which the parallel task of the Pulsar Sink runs.
|
void |
setParallelInstanceId(int parallelInstanceId)
Sets the number of the parallel subtask that the Kafka Producer is running on.
|
void |
setPartitions(int[] partitions)
Sets the available partitions for the topic returned from
PulsarContextAware.getTargetTopic(Object). |
public void setParallelInstanceId(int parallelInstanceId)
PulsarContextAwarePulsarContextAware.setNumParallelInstances(int)).setParallelInstanceId in interface PulsarContextAware<T>public void setNumParallelInstances(int numParallelInstances)
PulsarContextAwaresetNumParallelInstances in interface PulsarContextAware<T>public void setPartitions(int[] partitions)
PulsarContextAwarePulsarContextAware.getTargetTopic(Object).setPartitions in interface PulsarContextAware<T>public String getTargetTopic(T element)
PulsarContextAwaregetTargetTopic in interface PulsarContextAware<T>public void open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context)
throws Exception
PulsarSerializationSchemaPulsarSerializationSchema.serialize(Object) and thus suitable for one time setup work.
The provided SerializationSchema.InitializationContext can be used to access additional
features such as e.g. registering user metrics.
open in interface PulsarSerializationSchema<T>context - Contextual information that can be used during initialization.Exceptionpublic byte[] serialize(T element)
PulsarSerializationSchemaserialize in interface PulsarSerializationSchema<T>element - element to be serializedpublic void serialize(T element, org.apache.pulsar.client.api.TypedMessageBuilder<byte[]> messageBuilder)
serialize in interface PulsarSerializationSchema<T>public org.apache.pulsar.client.api.Schema<?> getPulsarSchema()
getPulsarSchema in interface PulsarSerializationSchema<T>public byte[] getKey(T element)
getKey in interface PulsarContextAware<T>Copyright © 2019–2021 The Apache Software Foundation. All rights reserved.