Skip to content

Commit

Permalink
version 0.10.2 bump
Browse files Browse the repository at this point in the history
  • Loading branch information
purbon committed Feb 23, 2020
1 parent ee65680 commit e0fae71
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.10.2:
* Add improved connection handling when talking with the RBAC MDS server
* Extended the test suite for rbac and isoleted test with the SASL plain suit.

v0.10.1:
* Fix the RPM builder script, build an rpm that create proper users for running the application.
* Fix param passing to the RBAC provider from the properties file.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.purbon.kafka</groupId>
<artifactId>kafka-topology-builder</artifactId>
<version>0.10.1</version>
<version>0.10.2</version>

<name>A Kafka topology builder tool</name>
<description>
Expand Down
29 changes: 13 additions & 16 deletions src/main/java/com/purbon/kafka/topology/KafkaTopologyBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static com.purbon.kafka.topology.TopologyBuilderConfig.ACCESS_CONTROL_IMPLEMENTATION_CLASS;
import static com.purbon.kafka.topology.TopologyBuilderConfig.MDS_KAFKA_CLUSTER_ID_CONFIG;
import static com.purbon.kafka.topology.TopologyBuilderConfig.MDS_PASSWORD_CONFIG;
import static com.purbon.kafka.topology.TopologyBuilderConfig.MDS_SERVER;
import static com.purbon.kafka.topology.TopologyBuilderConfig.MDS_USER_CONFIG;
import static com.purbon.kafka.topology.TopologyBuilderConfig.RBAC_ACCESS_CONTROL_CLASS;

Expand All @@ -27,18 +26,16 @@
public class KafkaTopologyBuilder {

private final String topologyFile;
private final Map<String, String> config;
private final TopologySerdes parser;
private final Properties properties;
private final TopologyBuilderAdminClient builderAdminClient;

public KafkaTopologyBuilder(String topologyFile, Map<String, String> config) {
public KafkaTopologyBuilder(String topologyFile, Map<String, String> cliParams) {
this.topologyFile = topologyFile;
this.config = config;
this.parser = new TopologySerdes();

this.properties = buildProperties(config);
this.builderAdminClient = buildTopologyAdminClient(config);
this.properties = buildProperties(cliParams);
this.builderAdminClient = buildTopologyAdminClient(cliParams);

}

Expand All @@ -57,10 +54,10 @@ public void run() throws IOException {
}

private AccessControlProvider buildAccessControlProvider() throws IOException {
String accessControlClass = config.getOrDefault(
String accessControlClass = properties.getOrDefault(
ACCESS_CONTROL_IMPLEMENTATION_CLASS,
"com.purbon.kafka.topology.roles.SimpleAclsProvider"
);
).toString();

try {
Class<?> clazz = Class.forName(accessControlClass);
Expand Down Expand Up @@ -94,29 +91,29 @@ private AccessControlProvider buildAccessControlProvider() throws IOException {
}
}

private Properties buildProperties(Map<String, String> config) {
private Properties buildProperties(Map<String, String> cliParams) {
Properties props = new Properties();
if (config.get(ADMIN_CLIENT_CONFIG_OPTION) != null) {
if (cliParams.get(ADMIN_CLIENT_CONFIG_OPTION) != null) {
try {
props.load(new FileInputStream(config.get(ADMIN_CLIENT_CONFIG_OPTION)));
props.load(new FileInputStream(cliParams.get(ADMIN_CLIENT_CONFIG_OPTION)));
} catch (IOException e) {
//TODO: Can be ignored
}
} else {
props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, config.get(BROKERS_OPTION));
props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, cliParams.get(BROKERS_OPTION));
}
props.put(AdminClientConfig.RETRIES_CONFIG, Integer.MAX_VALUE);

return props;
}

private TopologyBuilderAdminClient buildTopologyAdminClient(Map<String, String> config) {
AdminClient kafkaAdminClient = buildKafkaAdminClient(config);
private TopologyBuilderAdminClient buildTopologyAdminClient(Map<String, String> cliParams) {
AdminClient kafkaAdminClient = buildKafkaAdminClient(cliParams);
return new TopologyBuilderAdminClient(kafkaAdminClient);
}

private AdminClient buildKafkaAdminClient(Map<String, String> config) {
Properties props = buildProperties(config);
private AdminClient buildKafkaAdminClient(Map<String, String> cliParams) {
Properties props = buildProperties(cliParams);
return AdminClient.create(props);
}

Expand Down

0 comments on commit e0fae71

Please sign in to comment.