public class KafkaSinkFunction extends org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer<SinkRecord> implements LogSinkFunction
org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.ContextStateSerializer, org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.KafkaTransactionContext, org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.KafkaTransactionState, org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.NextTransactionalIdHint, org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.NextTransactionalIdHintSerializer, org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.Semantic, org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.TransactionStateSerializer
org.apache.flink.streaming.api.functions.sink.TwoPhaseCommitSinkFunction.State<TXN,CONTEXT>, org.apache.flink.streaming.api.functions.sink.TwoPhaseCommitSinkFunction.StateSerializer<TXN,CONTEXT>, org.apache.flink.streaming.api.functions.sink.TwoPhaseCommitSinkFunction.StateSerializerSnapshot<TXN,CONTEXT>, org.apache.flink.streaming.api.functions.sink.TwoPhaseCommitSinkFunction.TransactionHolder<TXN>
LogSinkFunction.WriteCallback
asyncException, callback, DEFAULT_KAFKA_PRODUCERS_POOL_SIZE, DEFAULT_KAFKA_TRANSACTION_TIMEOUT, defaultTopicId, KEY_DISABLE_METRICS, pendingRecords, producerConfig, SAFE_SCALE_DOWN_FACTOR, semantic, topicPartitionsMap, writeTimestampToKafka
Constructor and Description |
---|
KafkaSinkFunction(String defaultTopic,
org.apache.flink.streaming.connectors.kafka.KafkaSerializationSchema<SinkRecord> serializationSchema,
Properties producerConfig,
org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.Semantic semantic)
Creates a
KafkaSinkFunction for a given topic. |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flush pending records.
|
void |
open(org.apache.flink.configuration.Configuration configuration) |
void |
setWriteCallback(LogSinkFunction.WriteCallback writeCallback) |
abort, acknowledgeMessage, beginTransaction, checkErroneous, close, commit, createProducer, finishRecoveringContext, getPartitionsByTopic, getTransactionTimeout, ignoreFailuresAfterTransactionTimeout, initializeState, initializeUserContext, invoke, preCommit, recoverAndAbort, recoverAndCommit, setLogFailuresOnly, setTransactionalIdPrefix, setWriteTimestampToKafka, snapshotState
currentTransaction, enableTransactionTimeoutWarnings, finish, finishProcessing, getUserContext, invoke, invoke, notifyCheckpointAborted, notifyCheckpointComplete, pendingTransactions, setTransactionTimeout
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public KafkaSinkFunction(String defaultTopic, org.apache.flink.streaming.connectors.kafka.KafkaSerializationSchema<SinkRecord> serializationSchema, Properties producerConfig, org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.Semantic semantic)
KafkaSinkFunction
for a given topic. The sink produces its input to the
topic. It accepts a KafkaSerializationSchema
for serializing records to a ProducerRecord
, including partitioning information.defaultTopic
- The default topic to write data toserializationSchema
- A serializable serialization schema for turning user objects into
a kafka-consumable byte[] supporting key/value messagesproducerConfig
- Configuration properties for the KafkaProducer. 'bootstrap.servers.' is
the only required argument.semantic
- Defines semantic that will be used by this producer (see KafkaSinkFunction.Semantic
).public void setWriteCallback(LogSinkFunction.WriteCallback writeCallback)
setWriteCallback
in interface LogSinkFunction
public void open(org.apache.flink.configuration.Configuration configuration) throws Exception
open
in interface org.apache.flink.api.common.functions.RichFunction
open
in class org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer<SinkRecord>
Exception
public void flush() throws org.apache.flink.streaming.connectors.kafka.FlinkKafkaException
LogSinkFunction
flush
in interface LogSinkFunction
org.apache.flink.streaming.connectors.kafka.FlinkKafkaException
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.