Class DefaultKafkaProducerFactory.CloseSafeProducer<K,V>

java.lang.Object
org.springframework.kafka.core.DefaultKafkaProducerFactory.CloseSafeProducer<K,V>
Type Parameters:
K - the key type.
V - the value type.
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.clients.producer.Producer<K,V>
Enclosing class:
DefaultKafkaProducerFactory<K,V>

protected static class DefaultKafkaProducerFactory.CloseSafeProducer<K,V> extends Object implements org.apache.kafka.clients.producer.Producer<K,V>
A wrapper class for the delegate.
  • Method Details

    • send

      public Future<org.apache.kafka.clients.producer.RecordMetadata> send(org.apache.kafka.clients.producer.ProducerRecord<K,V> record)
      Specified by:
      send in interface org.apache.kafka.clients.producer.Producer<K,V>
    • send

      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)
      Specified by:
      send in interface org.apache.kafka.clients.producer.Producer<K,V>
    • flush

      public void flush()
      Specified by:
      flush in interface org.apache.kafka.clients.producer.Producer<K,V>
    • partitionsFor

      public List<org.apache.kafka.common.PartitionInfo> partitionsFor(String topic)
      Specified by:
      partitionsFor in interface org.apache.kafka.clients.producer.Producer<K,V>
    • metrics

      public Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric> metrics()
      Specified by:
      metrics in interface org.apache.kafka.clients.producer.Producer<K,V>
    • clientInstanceId

      public org.apache.kafka.common.Uuid clientInstanceId(Duration timeout)
      Specified by:
      clientInstanceId in interface org.apache.kafka.clients.producer.Producer<K,V>
    • initTransactions

      public void initTransactions()
      Specified by:
      initTransactions in interface org.apache.kafka.clients.producer.Producer<K,V>
    • beginTransaction

      public void beginTransaction() throws org.apache.kafka.common.errors.ProducerFencedException
      Specified by:
      beginTransaction in interface org.apache.kafka.clients.producer.Producer<K,V>
      Throws:
      org.apache.kafka.common.errors.ProducerFencedException
    • sendOffsetsToTransaction

      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
      Specified by:
      sendOffsetsToTransaction in interface org.apache.kafka.clients.producer.Producer<K,V>
      Throws:
      org.apache.kafka.common.errors.ProducerFencedException
    • sendOffsetsToTransaction

      public void sendOffsetsToTransaction(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, org.apache.kafka.clients.consumer.ConsumerGroupMetadata groupMetadata) throws org.apache.kafka.common.errors.ProducerFencedException
      Specified by:
      sendOffsetsToTransaction in interface org.apache.kafka.clients.producer.Producer<K,V>
      Throws:
      org.apache.kafka.common.errors.ProducerFencedException
    • commitTransaction

      public void commitTransaction() throws org.apache.kafka.common.errors.ProducerFencedException
      Specified by:
      commitTransaction in interface org.apache.kafka.clients.producer.Producer<K,V>
      Throws:
      org.apache.kafka.common.errors.ProducerFencedException
    • abortTransaction

      public void abortTransaction() throws org.apache.kafka.common.errors.ProducerFencedException
      Specified by:
      abortTransaction in interface org.apache.kafka.clients.producer.Producer<K,V>
      Throws:
      org.apache.kafka.common.errors.ProducerFencedException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.kafka.clients.producer.Producer<K,V>
    • close

      public void close(@Nullable Duration timeout)
      Specified by:
      close in interface org.apache.kafka.clients.producer.Producer<K,V>
    • toString

      public String toString()
      Overrides:
      toString in class Object