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()
Deprecated.
in favor of
KafkaUtils.clearConsumerGroupId() . |
static java.lang.String |
getConsumerGroupId()
Deprecated.
in favor of
KafkaUtils.getConsumerGroupId() . |
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,
java.lang.String txIdPrefix,
java.time.Duration closeTimeout)
Obtain a Producer that is synchronized with the current transaction, if any.
|
static <K,V> void |
releaseResources(KafkaResourceHolder<K,V> resourceHolder) |
static void |
setConsumerGroupId(java.lang.String groupId)
Deprecated.
in favor of
KafkaUtils.setConsumerGroupId(String) . |
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 forpublic 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> KafkaResourceHolder<K,V> getTransactionalResourceHolder(ProducerFactory<K,V> producerFactory, @Nullable java.lang.String txIdPrefix, java.time.Duration closeTimeout)
K
- the key type.V
- the value type.producerFactory
- the ProducerFactory to obtain a Channel fortxIdPrefix
- the transaction id prefix; if null, the producer factory
prefix is used.closeTimeout
- the producer close timeout.public static <K,V> void releaseResources(@Nullable KafkaResourceHolder<K,V> resourceHolder)
@Deprecated public static void setConsumerGroupId(java.lang.String groupId)
KafkaUtils.setConsumerGroupId(String)
.groupId
- the group id.@Deprecated public static java.lang.String getConsumerGroupId()
KafkaUtils.getConsumerGroupId()
.@Deprecated public static void clearConsumerGroupId()
KafkaUtils.clearConsumerGroupId()
.