Skip to content

Provide auto-configuration for Spring for Apache Kafka's reactive support #18804

@rycee

Description

@rycee

To produce a ReactiveKafkaProducerTemplate I have to explicitly include the ProducerConfig.TRANSACTIONAL_ID_CONFIG property as per the following example

@Bean
public ReactiveKafkaProducerTemplate<String, byte[]> reactiveKafkaProducerTemplate(
    KafkaProperties properties) {
  Map<String, Object> props = properties.buildProducerProperties();
  props.put(
      ProducerConfig.TRANSACTIONAL_ID_CONFIG, properties.getProducer().getTransactionIdPrefix());
  return new ReactiveKafkaProducerTemplate<>(SenderOptions.create(props));
}

I would have expected this property to be included by default when calling properties.buildProducerProperties() making

@Bean
public ReactiveKafkaProducerTemplate<String, byte[]> reactiveKafkaProducerTemplate(
    KafkaProperties properties) {
  Map<String, Object> props = properties.buildProducerProperties();
  return new ReactiveKafkaProducerTemplate<>(SenderOptions.create(props));
}

work.

The transactional ID prefix property was added in #11076.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions