public final class ProducerFactoryUtils
extends java.lang.Object
DefaultKafkaProducerFactory
in particular for obtaining transactional Kafka resources for a given ProducerFactory.
Mainly for internal use within the framework.
| Modifier and Type | Field and Description |
|---|---|
static java.time.Duration |
DEFAULT_CLOSE_TIMEOUT
The default close timeout (5 seconds).
|
| Modifier and Type | Method and Description |
|---|---|
static void |
clearConsumerGroupId()
Clear the group id for the consumer bound to this thread.
|
static java.lang.String |
getConsumerGroupId()
Get the group id for the consumer bound to this thread.
|
static <K,V> KafkaResourceHolder<K,V> |
getTransactionalResourceHolder(ProducerFactory<K,V> producerFactory)
Obtain a Producer that is synchronized with the current transaction, if any.
|
static <K,V> KafkaResourceHolder<K,V> |
getTransactionalResourceHolder(ProducerFactory<K,V> producerFactory,
java.time.Duration closeTimeout)
Obtain a Producer that is synchronized with the current transaction, if any.
|
static <K,V> KafkaResourceHolder<K,V> |
getTransactionalResourceHolder(ProducerFactory<K,V> producerFactory,
long closeTimeout)
Deprecated.
|
static <K,V> void |
releaseResources(KafkaResourceHolder<K,V> resourceHolder) |
static void |
setConsumerGroupId(java.lang.String groupId)
Set the group id for the consumer bound to this thread.
|
public static final java.time.Duration DEFAULT_CLOSE_TIMEOUT
public static <K,V> KafkaResourceHolder<K,V> getTransactionalResourceHolder(ProducerFactory<K,V> producerFactory)
K - the key type.V - the value type.producerFactory - the ProducerFactory to obtain a Channel for@Deprecated public static <K,V> KafkaResourceHolder<K,V> getTransactionalResourceHolder(ProducerFactory<K,V> producerFactory, long closeTimeout)
getTransactionalResourceHolder(ProducerFactory, Duration)K - the key type.V - the value type.producerFactory - the ProducerFactory to obtain a Channel forcloseTimeout - the producer close timeout.public static <K,V> KafkaResourceHolder<K,V> getTransactionalResourceHolder(ProducerFactory<K,V> producerFactory, java.time.Duration closeTimeout)
K - the key type.V - the value type.producerFactory - the ProducerFactory to obtain a Channel forcloseTimeout - the producer close timeout.public static <K,V> void releaseResources(@Nullable
KafkaResourceHolder<K,V> resourceHolder)
public static void setConsumerGroupId(java.lang.String groupId)
groupId - the group id.public static java.lang.String getConsumerGroupId()
public static void clearConsumerGroupId()