@PublicEvolving public class FlinkKafkaInternalProducer<K,V> extends Object implements org.apache.kafka.clients.producer.Producer<K,V>
Modifier and Type | Field and Description |
---|---|
protected org.apache.kafka.clients.producer.KafkaProducer<K,V> |
kafkaProducer |
protected String |
transactionalId |
Constructor and Description |
---|
FlinkKafkaInternalProducer(Properties properties) |
Modifier and Type | Method and Description |
---|---|
void |
abortTransaction() |
void |
beginTransaction() |
void |
close() |
void |
close(long timeout,
TimeUnit unit) |
void |
commitTransaction() |
void |
flush() |
protected static Enum<?> |
getEnum(String enumFullName) |
short |
getEpoch() |
long |
getProducerId() |
String |
getTransactionalId() |
int |
getTransactionCoordinatorId() |
protected static Object |
getValue(Object object,
String fieldName) |
void |
initTransactions() |
protected static Object |
invoke(Object object,
String methodName,
Object... args) |
Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric> |
metrics() |
List<org.apache.kafka.common.PartitionInfo> |
partitionsFor(String topic) |
void |
resumeTransaction(long producerId,
short epoch)
Instead of obtaining producerId and epoch from the transaction coordinator, re-use previously obtained ones,
so that we can resume transaction after a restart.
|
Future<org.apache.kafka.clients.producer.RecordMetadata> |
send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record) |
Future<org.apache.kafka.clients.producer.RecordMetadata> |
send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record,
org.apache.kafka.clients.producer.Callback callback) |
void |
sendOffsetsToTransaction(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets,
String consumerGroupId) |
protected static void |
setValue(Object object,
String fieldName,
Object value) |
public FlinkKafkaInternalProducer(Properties properties)
public void initTransactions()
public void beginTransaction() throws org.apache.kafka.common.errors.ProducerFencedException
org.apache.kafka.common.errors.ProducerFencedException
public void commitTransaction() throws org.apache.kafka.common.errors.ProducerFencedException
org.apache.kafka.common.errors.ProducerFencedException
public void abortTransaction() throws org.apache.kafka.common.errors.ProducerFencedException
org.apache.kafka.common.errors.ProducerFencedException
public void sendOffsetsToTransaction(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, String consumerGroupId) throws org.apache.kafka.common.errors.ProducerFencedException
org.apache.kafka.common.errors.ProducerFencedException
public Future<org.apache.kafka.clients.producer.RecordMetadata> send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record)
public Future<org.apache.kafka.clients.producer.RecordMetadata> send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record, org.apache.kafka.clients.producer.Callback callback)
public Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric> metrics()
public void close()
public void close(long timeout, TimeUnit unit)
public void flush()
public void resumeTransaction(long producerId, short epoch)
KafkaProducer#initTransactions
.
https://github.com/apache/kafka/commit/5d2422258cb975a137a42a4e08f03573c49a387e#diff-f4ef1afd8792cd2a2e9069cd7ddea630public String getTransactionalId()
public long getProducerId()
public short getEpoch()
@VisibleForTesting public int getTransactionCoordinatorId()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.