Class DefaultKafkaProducerFactory.CloseSafeProducer<K,​V>

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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abortTransaction()  
      void beginTransaction()  
      void close()  
      void close​(java.time.Duration timeout)  
      void commitTransaction()  
      void flush()  
      void initTransactions()  
      java.util.Map<org.apache.kafka.common.MetricName,​? extends org.apache.kafka.common.Metric> metrics()  
      java.util.List<org.apache.kafka.common.PartitionInfo> partitionsFor​(java.lang.String topic)  
      java.util.concurrent.Future<org.apache.kafka.clients.producer.RecordMetadata> send​(org.apache.kafka.clients.producer.ProducerRecord<K,​V> record)  
      java.util.concurrent.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​(java.util.Map<org.apache.kafka.common.TopicPartition,​org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, java.lang.String consumerGroupId)  
      void sendOffsetsToTransaction​(java.util.Map<org.apache.kafka.common.TopicPartition,​org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, org.apache.kafka.clients.consumer.ConsumerGroupMetadata groupMetadata)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.apache.kafka.clients.producer.Producer

        close
    • Method Detail

      • send

        public java.util.concurrent.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 java.util.concurrent.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 java.util.List<org.apache.kafka.common.PartitionInfo> partitionsFor​(java.lang.String topic)
        Specified by:
        partitionsFor in interface org.apache.kafka.clients.producer.Producer<K,​V>
      • metrics

        public java.util.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>
      • 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​(java.util.Map<org.apache.kafka.common.TopicPartition,​org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets,
                                             java.lang.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​(java.util.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 java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface org.apache.kafka.clients.producer.Producer<K,​V>
      • close

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object