public class PulsarRowSerializationSchema extends Object implements PulsarSerializationSchema<org.apache.flink.types.Row>, PulsarContextAware<org.apache.flink.types.Row>
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getKey(org.apache.flink.types.Row element) |
org.apache.pulsar.client.api.Schema<?> |
getPulsarSchema() |
String |
getTargetTopic(org.apache.flink.types.Row 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(org.apache.flink.types.Row element)
Serializes given element and returns it as a byte[].
|
void |
serialize(org.apache.flink.types.Row consumedRow,
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 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<org.apache.flink.types.Row>context - Contextual information that can be used during initialization.Exceptionpublic byte[] serialize(org.apache.flink.types.Row element)
PulsarSerializationSchemaserialize in interface PulsarSerializationSchema<org.apache.flink.types.Row>element - element to be serializedpublic void serialize(org.apache.flink.types.Row consumedRow,
org.apache.pulsar.client.api.TypedMessageBuilder<byte[]> messageBuilder)
serialize in interface PulsarSerializationSchema<org.apache.flink.types.Row>public org.apache.pulsar.client.api.Schema<?> getPulsarSchema()
getPulsarSchema in interface PulsarSerializationSchema<org.apache.flink.types.Row>public void setParallelInstanceId(int parallelInstanceId)
PulsarContextAwarePulsarContextAware.setNumParallelInstances(int)).setParallelInstanceId in interface PulsarContextAware<org.apache.flink.types.Row>public void setNumParallelInstances(int numParallelInstances)
PulsarContextAwaresetNumParallelInstances in interface PulsarContextAware<org.apache.flink.types.Row>public void setPartitions(int[] partitions)
PulsarContextAwarePulsarContextAware.getTargetTopic(Object).setPartitions in interface PulsarContextAware<org.apache.flink.types.Row>public String getTargetTopic(org.apache.flink.types.Row element)
PulsarContextAwaregetTargetTopic in interface PulsarContextAware<org.apache.flink.types.Row>public byte[] getKey(org.apache.flink.types.Row element)
getKey in interface PulsarContextAware<org.apache.flink.types.Row>Copyright © 2019–2021 The Apache Software Foundation. All rights reserved.