Skip to content

Remove SslBundles from KafkaProperties as it is no longer used #45727

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Torres-09
Copy link

@Torres-09 Torres-09 commented May 30, 2025

This PR removes the deprecated buildConsumerProperties(SslBundles) method from the KafkaProperties.

The removed test has been restored and updated to reflect the new logic. All tests and builds pass locally.

assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy(properties::buildConsumerProperties);

gh-45722

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 30, 2025
@Torres-09
Copy link
Author

I’d like to ask for guidance regarding the proper direction for this change.

Since buildConsumerProperties(SslBundles) has been removed, I'm deciding between two implementation options for buildConsumerProperties().

Option 1 – Minimal change (currently applied in PR):

public Map<String, Object> buildConsumerProperties() {
    Map<String, Object> properties = buildCommonProperties(null);
    properties.putAll(this.consumer.buildProperties(null));
    return properties;
}

This keeps the current method signature of buildProperties(SslBundles) and simply passes null, minimizing code changes.

Option 2 – Cleanup approach:

public Map<String, Object> buildConsumerProperties() {
    Map<String, Object> properties = buildCommonProperties(null);
    properties.putAll(this.consumer.buildProperties());
    return properties;
}
public static class Consumer {
    private final Ssl ssl = new Ssl();
    ...

    public Map<String, Object> buildProperties() {
        Properties properties = new Properties();
        PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
        map.from(this::getAutoCommitInterval)
            .asInt(Duration::toMillis)
            ...
            .to(properties.in(ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG));
        return properties.with(this.ssl, this.security, this.properties, null);
    }
}

This removes the now-unnecessary parameter entirely and results in a cleaner method.

Functionally, both options appear to be equivalent.

I'd love to hear your thoughts. Thank you!

@wilkinsona
Copy link
Member

Thanks for noticing this, @Torres-09. I think we should go for the second option. SslBundles appears in the signature of several methods in KafkaProperties but is never actually used. It looks like all references to SslBundles can be removed from KafkaProperties. This will require some small changes to its tests and a couple of configuration classes as well.

@wilkinsona wilkinsona changed the title Remove buildConsumerProperties(SslBundles) from KafkaProperties Remove SslBundles from KafkaProperties as it is not used May 30, 2025
@wilkinsona wilkinsona changed the title Remove SslBundles from KafkaProperties as it is not used Remove SslBundles from KafkaProperties as it is no longer used May 30, 2025
@Torres-09
Copy link
Author

@wilkinsona

Thank you for the feedback!

I’ll proceed to remove all remaining references to SslBundles from KafkaProperties, as well as update the related classes and tests accordingly. I’ll revise the PR to reflect these changes.

@@ -128,42 +114,6 @@ void sslPropertiesWhenTrustStoreLocationAndCertificatesSetShouldThrowException()
.isThrownBy(properties::buildConsumerProperties);
}

@Test
void sslPropertiesWhenKeyStoreLocationAndBundleSetShouldThrowException() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be kept but should call .isThrownBy(properties::buildConsumerProperties);.

}

@Test
void sslPropertiesWhenKeyStoreKeyAndBundleSetShouldThrowException() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be kept but should call .isThrownBy(properties::buildConsumerProperties);.

}

@Test
void sslPropertiesWhenTrustStoreLocationAndBundleSetShouldThrowException() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be kept but should call .isThrownBy(properties::buildConsumerProperties);.

}

@Test
void sslPropertiesWhenTrustStoreCertificatesAndBundleSetShouldThrowException() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be kept but should call .isThrownBy(properties::buildConsumerProperties);.

@Torres-09 Torres-09 requested a review from wilkinsona June 2, 2025 09:05
@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 2, 2025
@Torres-09
Copy link
Author

Torres-09 commented Jun 5, 2025

@wilkinsona 👋
I accidentally marked this conversation as resolved and forgot to leave a comment — sorry about that.

Thanks for the review. I've restored the four KafkaPropertiesTests and updated them using .isThrownBy(properties::buildConsumerProperties).

All tests pass locally. Let me know if anything else needs to be adjusted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants