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

Pass cluster configuration to adminconfig #381

Closed

Conversation

kYann
Copy link
Contributor

@kYann kYann commented Mar 15, 2023

Description

Pass cluster config to AdminClient

Fixes #380

How Has This Been Tested?

Tested to create topic.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have made corresponding changes to the documentation

Disclaimer

By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement

@@ -18,9 +18,13 @@ public ClusterManager(ILogHandler logHandler, ClusterConfiguration configuration
{
this.logHandler = logHandler;
this.configuration = configuration;
var adminConfig = new AdminClientConfig()
Copy link
Contributor

Choose a reason for hiding this comment

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

Since AdminClientBuilder is lazy, can we move the initialization of AdminClientConfig under the lazy initialization?
Something like this:

this.lazyAdminClientBuilder = new Lazy<AdminClientBuilder>(
    () =>
    {
        var adminConfig = new AdminClientConfig()
        {
            BootstrapServers = string.Join(",", configuration.Brokers),
        };
        adminConfig.ReadSecurityInformationFrom(configuration);

        return new AdminClientBuilder(adminConfig);
    });

@@ -70,5 +70,42 @@ public static void ReadSecurityInformationFrom(this ClientConfig config, Cluster
config.SaslUsername = securityInformation.SaslUsername;
config.SaslPassword = securityInformation.SaslPassword;
}

public static void ReadSecurityInformationFrom(this AdminClientConfig config, ClusterConfiguration cluster)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since AdminClientConfig inherits from ClientConfig the extension method ReadSecurityInformationFrom(this ClientConfig config, ClusterConfiguration cluster) can be reused.

@filipeesch
Copy link
Member

This change was made in #419

@filipeesch filipeesch closed this Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report]: AdminClient does not have cluster configuration and cannot connect
3 participants