Producer Contract

Producer is the contract of Kafka producers.

Note
KafkaProducer is the one and only known implementation of the Producer Contract in Apache Kafka.
Table 1. Producer Contract
Method Description

abortTransaction

void abortTransaction()
throws ProducerFencedException

Used when…​FIXME

beginTransaction

void beginTransaction()
throws ProducerFencedException

Used when…​FIXME

close

void close()
void close(long timeout, TimeUnit unit)

Used when…​FIXME

commitTransaction

void commitTransaction()
throws ProducerFencedException

Used when…​FIXME

flush

void flush()

Used when…​FIXME

initTransactions

void initTransactions()

Initializes transactions (when the transactional.id is configured)

metrics

Map<MetricName, ? extends Metric> metrics()

The performance metrics

partitionsFor

List<PartitionInfo> partitionsFor(String topic)

The partition metadata for the given topic. This can be used for custom partitioning.

Used when…​FIXME

send

Future<RecordMetadata> send(
  ProducerRecord<K, V> record)
Future<RecordMetadata> send(
  ProducerRecord<K, V> record,
  Callback callback)

Sending a ProducerRecord to a Kafka cluster asynchronously

Used when…​FIXME

sendOffsetsToTransaction

void sendOffsetsToTransaction(
  Map<TopicPartition, OffsetAndMetadata> offsets,
  String consumerGroupId)
throws ProducerFencedException

Used when…​FIXME

results matching ""

    No results matching ""