Skip to content

Commit

Permalink
feat: improve admin config initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-sousa-8 authored and filipeesch committed Sep 15, 2023
1 parent 4941614 commit cb9075c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/KafkaFlow/Clusters/ClusterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@ internal class ClusterManager : IClusterManager
private readonly ILogHandler logHandler;
private readonly Lazy<AdminClientBuilder> lazyAdminClientBuilder;
private readonly ClusterConfiguration configuration;
private readonly ClientConfig clientConfig = new();

public ClusterManager(ILogHandler logHandler, ClusterConfiguration configuration)
{
this.logHandler = logHandler;
this.configuration = configuration;
this.clientConfig.ReadSecurityInformationFrom(this.configuration);
this.lazyAdminClientBuilder = new Lazy<AdminClientBuilder>(
() => new AdminClientBuilder(new AdminClientConfig(this.clientConfig)
{ BootstrapServers = string.Join(",", configuration.Brokers) }));
() =>
{
var adminConfig = new AdminClientConfig()
{
BootstrapServers = string.Join(",", configuration.Brokers),
};
adminConfig.ReadSecurityInformationFrom(configuration);
return new AdminClientBuilder(adminConfig);
});
}

public string ClusterName => this.configuration.Name;
Expand Down

0 comments on commit cb9075c

Please sign in to comment.