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

Methods to build producer / consumer properties from KafkaProperties are inconvienenent to use without an SSL bundle #43300

Closed
kitkars opened this issue Nov 27, 2024 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@kitkars
Copy link

kitkars commented Nov 27, 2024

This request is related to 39144.

We used to have below methods in the KafkaProperties class.

buildProducerProperties()
buildConsumerProperties()

Looks like they have been removed / modified to accept SslBundles from 3.4.

buildProducerProperties(SslBundles sslBundles)
buildConsumerProperties(SslBundles sslBundles)

The Reactive Kafka Producer / Consumer Template classes have an option to accept the SenderOptions / ReceiverOptions as shown below. As the buildConsumerProperties requires SslBundles , I can pass null to make the code work as suggested in other thread.

    @Bean
    public ReceiverOptions<String,MyEvent> receiverOptions(KafkaProperties kafkaProperties){
        return ReceiverOptions.<String, MyEvent>create(kafkaProperties.buildConsumerProperties(null))
                .consumerProperty(JsonDeserializer.REMOVE_TYPE_INFO_HEADERS, "false")
                .consumerProperty(JsonDeserializer.USE_TYPE_INFO_HEADERS, false)
                .consumerProperty(JsonDeserializer.VALUE_DEFAULT_TYPE, MyEvent.class)
                .subscription(List.of("my-events"));
    }

    @Bean
    public ReactiveKafkaConsumerTemplate<String, MyEvent> consumerTemplate(ReceiverOptions<String, MyEvent> options){
        return new ReactiveKafkaConsumerTemplate<>(options);
    }

However, It is really convenient to have simple below overloaded method as part of the KafkaProperties class itself which calls the appropriate methods with null.

buildProducerProperties()
buildConsumerProperties()

It would be great if you consider this request.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 27, 2024
@philwebb philwebb added for: team-meeting An issue we'd like to discuss as a team to make progress type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels Dec 2, 2024
@philwebb philwebb added this to the 3.4.x milestone Dec 9, 2024
@philwebb philwebb self-assigned this Dec 9, 2024
@philwebb philwebb added type: bug A general bug and removed type: enhancement A general enhancement labels Dec 9, 2024
@philwebb philwebb modified the milestones: 3.4.x, 3.3.x Dec 9, 2024
@philwebb philwebb changed the title Add the overloaded methods to build producer / consumer properties from KafkaProperties Methods to build producer / consumer properties from KafkaProperties are inconvienenent to use without an SSL bundle Dec 9, 2024
@philwebb
Copy link
Member

philwebb commented Dec 9, 2024

We discussed this today, and although we don't consider these methods as public API having more convenient alternatives feels like something we can add. I'm considering this a "bug of omission" since it's so low risk to add to 3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants