Class KafkaResourceHolder<K,V>

java.lang.Object
org.springframework.transaction.support.ResourceHolderSupport
org.springframework.kafka.core.KafkaResourceHolder<K,V>
Type Parameters:
K - the key type.
V - the value type.
All Implemented Interfaces:
ResourceHolder

public class KafkaResourceHolder<K,V> extends ResourceHolderSupport
Kafka resource holder, wrapping a Kafka producer. KafkaTransactionManager binds instances of this class to the thread, for a given Kafka producer factory.
Author:
Gary Russell
  • Constructor Details

    • KafkaResourceHolder

      public KafkaResourceHolder(org.apache.kafka.clients.producer.Producer<K,V> producer, Duration closeTimeout)
      Construct an instance for the producer.
      Parameters:
      producer - the producer.
      closeTimeout - the close timeout.
  • Method Details

    • getProducer

      public org.apache.kafka.clients.producer.Producer<K,V> getProducer()
    • commit

      public void commit()
    • close

      public void close()
    • rollback

      public void rollback()