|
|
@ -96,11 +96,12 @@ public class KafkaAutoConfiguration {
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean(ProducerFactory.class)
|
|
|
|
@ConditionalOnMissingBean(ProducerFactory.class)
|
|
|
|
public ProducerFactory<?, ?> kafkaProducerFactory() {
|
|
|
|
public ProducerFactory<?, ?> kafkaProducerFactory() {
|
|
|
|
DefaultKafkaProducerFactory<Object, Object> factory = new DefaultKafkaProducerFactory<>(
|
|
|
|
DefaultKafkaProducerFactory<?, ?> factory = new DefaultKafkaProducerFactory<>(
|
|
|
|
this.properties.buildProducerProperties());
|
|
|
|
this.properties.buildProducerProperties());
|
|
|
|
KafkaProperties.Producer producer = this.properties.getProducer();
|
|
|
|
String transactionIdPrefix = this.properties.getProducer()
|
|
|
|
if (producer.getTransactionIdPrefix() != null) {
|
|
|
|
.getTransactionIdPrefix();
|
|
|
|
factory.setTransactionIdPrefix(producer.getTransactionIdPrefix());
|
|
|
|
if (transactionIdPrefix != null) {
|
|
|
|
|
|
|
|
factory.setTransactionIdPrefix(transactionIdPrefix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return factory;
|
|
|
|
return factory;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -108,7 +109,8 @@ public class KafkaAutoConfiguration {
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnProperty(name = "spring.kafka.producer.transaction-id-prefix")
|
|
|
|
@ConditionalOnProperty(name = "spring.kafka.producer.transaction-id-prefix")
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
public KafkaTransactionManager<?, ?> kafkaTransactionManager(ProducerFactory<?, ?> producerFactory) {
|
|
|
|
public KafkaTransactionManager<?, ?> kafkaTransactionManager(
|
|
|
|
|
|
|
|
ProducerFactory<?, ?> producerFactory) {
|
|
|
|
return new KafkaTransactionManager<>(producerFactory);
|
|
|
|
return new KafkaTransactionManager<>(producerFactory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|