Class KafkaSerializationSchemaWrapper<T>
java.lang.Object
org.apache.flink.streaming.connectors.kafka.internals.KafkaSerializationSchemaWrapper<T>
- All Implemented Interfaces:
Serializable,KafkaContextAware<T>,KafkaSerializationSchema<T>
@Internal
@Deprecated
public class KafkaSerializationSchemaWrapper<T>
extends Object
implements KafkaSerializationSchema<T>, KafkaContextAware<T>
Deprecated.
An adapter from old style interfaces such as
SerializationSchema, FlinkKafkaPartitioner to the KafkaSerializationSchema.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKafkaSerializationSchemaWrapper(String topic, FlinkKafkaPartitioner<T> partitioner, boolean writeTimestamp, org.apache.flink.api.common.serialization.SerializationSchema<T> serializationSchema) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptiongetTargetTopic(T element) Deprecated.Returns the topic that the presented element should be sent to.voidopen(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context) Deprecated.Initialization method for the schema.org.apache.kafka.clients.producer.ProducerRecord<byte[], byte[]> Deprecated.Serializes given element and returns it as aProducerRecord.voidsetNumParallelInstances(int numParallelInstances) Deprecated.Sets the parallelism with which the parallel task of the Kafka Producer runs.voidsetParallelInstanceId(int parallelInstanceId) Deprecated.Sets the number of the parallel subtask that the Kafka Producer is running on.voidsetPartitions(int[] partitions) Deprecated.Sets the available partitions for the topic returned fromKafkaContextAware.getTargetTopic(Object).voidsetWriteTimestamp(boolean writeTimestamp) Deprecated.
-
Constructor Details
-
KafkaSerializationSchemaWrapper
public KafkaSerializationSchemaWrapper(String topic, FlinkKafkaPartitioner<T> partitioner, boolean writeTimestamp, org.apache.flink.api.common.serialization.SerializationSchema<T> serializationSchema) Deprecated.
-
-
Method Details
-
open
public void open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context) throws Exception Deprecated.Description copied from interface:KafkaSerializationSchemaInitialization method for the schema. It is called before the actual working methodsKafkaSerializationSchema.serialize(Object, Long)and thus suitable for one time setup work.The provided
SerializationSchema.InitializationContextcan be used to access additional features such as e.g. registering user metrics.- Specified by:
openin interfaceKafkaSerializationSchema<T>- Parameters:
context- Contextual information that can be used during initialization.- Throws:
Exception
-
serialize
public org.apache.kafka.clients.producer.ProducerRecord<byte[],byte[]> serialize(T element, @Nullable Long timestamp) Deprecated.Description copied from interface:KafkaSerializationSchemaSerializes given element and returns it as aProducerRecord.- Specified by:
serializein interfaceKafkaSerializationSchema<T>- Parameters:
element- element to be serializedtimestamp- timestamp (can be null)- Returns:
- Kafka
ProducerRecord
-
getTargetTopic
Deprecated.Description copied from interface:KafkaContextAwareReturns the topic that the presented element should be sent to. This is not used for setting the topic (this is done via theProducerRecordthat is returned fromKafkaSerializationSchema.serialize(Object, Long), it is only used for getting the available partitions that are presented toKafkaContextAware.setPartitions(int[]).- Specified by:
getTargetTopicin interfaceKafkaContextAware<T>
-
setPartitions
public void setPartitions(int[] partitions) Deprecated.Description copied from interface:KafkaContextAwareSets the available partitions for the topic returned fromKafkaContextAware.getTargetTopic(Object).- Specified by:
setPartitionsin interfaceKafkaContextAware<T>
-
setParallelInstanceId
public void setParallelInstanceId(int parallelInstanceId) Deprecated.Description copied from interface:KafkaContextAwareSets the number of the parallel subtask that the Kafka Producer is running on. The numbering starts from 0 and goes up to parallelism-1 (parallelism as returned byKafkaContextAware.setNumParallelInstances(int)).- Specified by:
setParallelInstanceIdin interfaceKafkaContextAware<T>
-
setNumParallelInstances
public void setNumParallelInstances(int numParallelInstances) Deprecated.Description copied from interface:KafkaContextAwareSets the parallelism with which the parallel task of the Kafka Producer runs.- Specified by:
setNumParallelInstancesin interfaceKafkaContextAware<T>
-
setWriteTimestamp
public void setWriteTimestamp(boolean writeTimestamp) Deprecated.
-