Skip to content
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

Example in Producer/Consumer Interceptors section of Spring Framework documentation need to be fixed #3587

Closed
jourteen opened this issue Oct 22, 2024 · 3 comments

Comments

@jourteen
Copy link

Wiring Spring Beans into Producer/Consumer Interceptors section of Spring for Apache Kafka documentation contains following code snippet:

@Bean
public ProducerFactory<?, ?> kafkaProducerFactory(SomeBean someBean) {
    Map<String, Object> producerProperties = new HashMap<>();
    // producerProperties.put(..., ...)
    // ...
    Map<String, Object> producerProperties = properties.buildProducerProperties();
    producerProperties.put(ProducerConfig.INTERCEPTOR_CLASSES_CONFIG, MyProducerInterceptor.class.getName());
    producerProperties.put("some.bean", someBean);
    DefaultKafkaProducerFactory<?, ?> factory = new DefaultKafkaProducerFactory<>(producerProperties);
    return factory;
}

I understand this is just an example, but creating producerProperties twice is confusing. I suggest to completely remove the second instance to make kafkaProducerFactory look similar to kafkaConsumerFactory.

@artembilan
Copy link
Member

@jourteen , please, be our guest with a contribution: https://github.com/spring-projects/spring-kafka/blob/main/CONTRIBUTING.adoc !

@JiwonKKang
Copy link
Contributor

Would it be alright if I submitted a PR for this?

@sobychacko
Copy link
Contributor

PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants