Skip to content

Conversation

@garyrussell
Copy link
Contributor

  • transaction manager
  • error handler
  • after rollback processor

- transaction manager
- error handler
- after rollback processor
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 27, 2018
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 27, 2018
@philwebb philwebb added this to the Backlog milestone Aug 27, 2018
Copy link
Member

@snicoll snicoll left a 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
Copy link
Member

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).

Copy link
Contributor Author

@garyrussell garyrussell Aug 28, 2018

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.
Copy link
Member

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).

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Aug 28, 2018
@snicoll snicoll changed the title More Kafka Auto-configuration Improve Kafka Auto-configuration Aug 28, 2018
@snicoll snicoll self-assigned this Aug 28, 2018
@snicoll snicoll removed the status: waiting-for-feedback We need additional information before we can continue label Aug 28, 2018
@snicoll snicoll modified the milestones: Backlog, 2.1.0.M3 Aug 28, 2018
snicoll pushed a commit that referenced this pull request Aug 28, 2018
- transaction manager
- error handler
- after rollback processor

See gh-14215
@snicoll snicoll closed this in b7ae558 Aug 28, 2018
snicoll added a commit that referenced this pull request Aug 28, 2018
* pr/14215:
  Polish "Improve Kafka Auto-configuration"
  Improve Kafka Auto-configuration
@snicoll
Copy link
Member

snicoll commented Aug 28, 2018

Thanks @garyrussell, this is now merged in master.

@philwebb philwebb changed the title Improve Kafka Auto-configuration Support transaction manager, error handler and after rollback processor with Kafka Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants