Skip to content

Commit

Permalink
feat: Remove log
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenzo-ingenito committed Dec 16, 2024
1 parent ad05625 commit 2bf16d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,26 @@ public Map<String, Object> producerConfigs() {
InetAddress id = getLocalHost();

props.put(ProducerConfig.CLIENT_ID_CONFIG, kafkaProducerPropCFG.getClientId() + "-tx" + "-" + id );
System.out.println("CLIENT_ID_CONFIG:"+kafkaProducerPropCFG.getClientId() + "-tx" + "-" + id);
props.put(ProducerConfig.RETRIES_CONFIG, kafkaProducerPropCFG.getRetries());
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaProducerPropCFG.getProducerBootstrapServers());
System.out.println("BOOTSTRAP:"+kafkaProducerPropCFG.getProducerBootstrapServers());
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, kafkaProducerPropCFG.getKeySerializer());
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, kafkaProducerPropCFG.getValueSerializer());
props.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, id + "-" + kafkaProducerPropCFG.getTransactionalId());
System.out.println("TRANSACTION_ID:"+id + "-" + kafkaProducerPropCFG.getTransactionalId());
props.put(ProducerConfig.ACKS_CONFIG,kafkaProducerPropCFG.getAck());
props.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG,kafkaProducerPropCFG.getIdempotence());

System.out.println("PROTOCOL:"+kafkaPropCFG.getProtocol());
if (!StringUtility.isNullOrEmpty(kafkaPropCFG.getProtocol())) {
props.put("security.protocol", kafkaPropCFG.getProtocol());
}

System.out.println("MECHANISM:"+kafkaPropCFG.getMechanism());
if (!StringUtility.isNullOrEmpty(kafkaPropCFG.getMechanism())) {
props.put("sasl.mechanism", kafkaPropCFG.getMechanism());
}

System.out.println("CONFIG JAAS:"+kafkaPropCFG.getConfigJaas());
if (!StringUtility.isNullOrEmpty(kafkaPropCFG.getConfigJaas())) {
props.put("sasl.jaas.config", kafkaPropCFG.getConfigJaas());
}

System.out.println("TRUSTORE LOCATION:"+kafkaPropCFG.getTrustoreLocation());
if (!StringUtility.isNullOrEmpty(kafkaPropCFG.getTrustoreLocation())) {
props.put("ssl.truststore.location", kafkaPropCFG.getTrustoreLocation());
}
Expand All @@ -101,13 +94,9 @@ public Map<String, Object> producerConfigs() {
if("OAUTHBEARER".equals(kafkaPropCFG.getMechanism())) {
props.put("sasl.login.callback.handler.class", CustomAuthenticateCallbackHandler.class);
props.put("kafka.oauth.tenantId", kafkaPropCFG.getTenantId());
System.out.println("TENNT ID:"+kafkaPropCFG.getTenantId());
props.put("kafka.oauth.appId", kafkaPropCFG.getAppId());
System.out.println("APP ID:"+kafkaPropCFG.getAppId());
props.put("kafka.oauth.pfxPathName", kafkaPropCFG.getPfxPathName());
System.out.println("PFX PATHNAME:"+kafkaPropCFG.getPfxPathName());
props.put("kafka.oauth.pwd", kafkaPropCFG.getPwd());
System.out.println("PASS:"+kafkaPropCFG.getPwd());
}

return props;
Expand Down Expand Up @@ -156,46 +145,35 @@ public Map<String, Object> producerWithoutTransactionConfigs() {
props.put(ProducerConfig.CLIENT_ID_CONFIG, kafkaProducerPropCFG.getClientId()+ "-noTx");
props.put(ProducerConfig.RETRIES_CONFIG, kafkaProducerPropCFG.getRetries());
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaProducerPropCFG.getProducerBootstrapServers());
System.out.println("BOOTSTRAP:"+kafkaProducerPropCFG.getProducerBootstrapServers());
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, kafkaProducerPropCFG.getKeySerializer());
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, kafkaProducerPropCFG.getValueSerializer());


System.out.println("PROTOCOL:"+kafkaPropCFG.getProtocol());
if (!StringUtility.isNullOrEmpty(kafkaPropCFG.getProtocol())) {
props.put("security.protocol", kafkaPropCFG.getProtocol());
}

System.out.println("MECHANISM:"+kafkaPropCFG.getMechanism());
if (!StringUtility.isNullOrEmpty(kafkaPropCFG.getMechanism())) {
props.put("sasl.mechanism", kafkaPropCFG.getMechanism());
}

System.out.println("CONFIG JAAS:"+kafkaPropCFG.getConfigJaas());
if (!StringUtility.isNullOrEmpty(kafkaPropCFG.getConfigJaas())) {
props.put("sasl.jaas.config", kafkaPropCFG.getConfigJaas());
}

System.out.println("TRUSTORE LOCATION:"+kafkaPropCFG.getTrustoreLocation());
if (!StringUtility.isNullOrEmpty(kafkaPropCFG.getTrustoreLocation())) {
props.put("ssl.truststore.location", kafkaPropCFG.getTrustoreLocation());
}

if (kafkaPropCFG.getTrustorePassword() != null && kafkaPropCFG.getTrustorePassword().length > 0) {
props.put("ssl.truststore.password", String.valueOf(kafkaPropCFG.getTrustorePassword()));
System.out.println("TRUSTORE PWD:"+String.valueOf(kafkaPropCFG.getTrustorePassword()));
}

if("OAUTHBEARER".equals(kafkaPropCFG.getMechanism())) {
props.put("sasl.login.callback.handler.class", CustomAuthenticateCallbackHandler.class);
props.put("kafka.oauth.tenantId", kafkaPropCFG.getTenantId());
System.out.println("TENNT ID:"+kafkaPropCFG.getTenantId());
props.put("kafka.oauth.appId", kafkaPropCFG.getAppId());
System.out.println("APP ID:"+kafkaPropCFG.getAppId());
props.put("kafka.oauth.pfxPathName", kafkaPropCFG.getPfxPathName());
System.out.println("PFX PATHNAME:"+kafkaPropCFG.getPfxPathName());
props.put("kafka.oauth.pwd", kafkaPropCFG.getPwd());
System.out.println("PASS:"+kafkaPropCFG.getPwd());
}


Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
<producerConfig>kafka.oauth.appId=${kafka.oauth.appId}</producerConfig>
<producerConfig>kafka.oauth.pfxPathName=${kafka.oauth.pfxPathName}</producerConfig>
<producerConfig>kafka.oauth.pwd=${kafka.oauth.pwd}</producerConfig>
<springProfile name="default">
<producerConfig>ssl.truststore.location=${kafka.properties.ssl.truststore.location}</producerConfig>
<producerConfig>ssl.truststore.password=${kafka.properties.ssl.truststore.password}</producerConfig>
</springProfile>
</appender>
</logger>

Expand Down

0 comments on commit 2bf16d0

Please sign in to comment.