-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another
Description
As per docs, we need to provide transactionIdPrefix in order to enable transaction support. It will be nice if we can add a field like transactionIdPrefix in Producer and use it in DefaultKafkaProducerFactory to support properties based configuration like spring.kafka.producer.transaction-id-prefix in application.properties .
Current Situation:
ATM, we have to manually create a bean just to enable the transaction support. E.g. (the code below is in Kotlin, but we have to do the same thing in Java)
@Bean
fun kafkaProducerFactory(properties : KafkaProperties): ProducerFactory<*, *> {
val defaultKafkaProducerFactory = DefaultKafkaProducerFactory<Any, Any>(properties.buildProducerProperties())
defaultKafkaProducerFactory.setTransactionIdPrefix("txn-ingestor") // transaction-id can be application name or something in that line
return defaultKafkaProducerFactory
}
@Bean
fun transactionManager(producerFactory : ProducerFactory<*, *>) : KafkaTransactionManager<*, *> {
return KafkaTransactionManager(producerFactory)
}
I am using:
Spring-KafkaVersion 2.0.1.RELEASE
SpringBootVersion 2.0.0.M6
If it sounds good than I can submit a PR, more details here spring-kafka-482
Metadata
Metadata
Assignees
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another