-
Couldn't load subscription status.
- Fork 41.6k
Support transaction manager, error handler and after rollback processor with Kafka #14215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
garyrussell
commented
Aug 27, 2018
- transaction manager
- error handler
- after rollback processor
- transaction manager - error handler - after rollback processor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I've added a couple of questions/suggestions.
| automatically associated to the default factory. | ||
| `spring.kafka.listener.*`. | ||
| If the property `spring.kafka.producer.transaction-id-prefix` is defined, a | ||
| `KafkaTransactionManager` will be auto-configured with name `kafkaTransactionManager` and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the behaviour implemented? All I can see here is that a TransactionManager is associated if it exists. Is @EnableKafka doing that for us? Is that a PlatformTransactionManager (in which case we need to be careful about conflicts).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A TM is already autoconfigured in KafkaAutoConfiguration, but I guess it was never documented (looks like a community contribution).
@Bean
@ConditionalOnProperty(name = "spring.kafka.producer.transaction-id-prefix")
@ConditionalOnMissingBean
public KafkaTransactionManager<?, ?> kafkaTransactionManager(
ProducerFactory<?, ?> producerFactory) {
return new KafkaTransactionManager<>(producerFactory);
}(I wasn't aware of it either - it threw me a bit when I got weird results).
| instance. | ||
| When using a `ChainedKafkaTransactionManager`, it will usually reference the configured | ||
| `KafkaTransactionManager` bean, so the chained manager must be marked | ||
| `@Primary` if you want it wired into the container factory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand that note (probably related to the fact I am confused per my other comment).
- transaction manager - error handler - after rollback processor See gh-14215
* pr/14215: Polish "Improve Kafka Auto-configuration" Improve Kafka Auto-configuration
|
Thanks @garyrussell, this is now merged in |