diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/config/kafka/KafkaProducerCFG.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/config/kafka/KafkaProducerCFG.java index b15c0f1..fd28f8f 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/config/kafka/KafkaProducerCFG.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/config/kafka/KafkaProducerCFG.java @@ -62,33 +62,26 @@ public Map 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()); } @@ -101,13 +94,9 @@ public Map 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; @@ -156,46 +145,35 @@ public Map 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()); } diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index bb426a6..610e4ab 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -77,6 +77,10 @@ kafka.oauth.appId=${kafka.oauth.appId} kafka.oauth.pfxPathName=${kafka.oauth.pfxPathName} kafka.oauth.pwd=${kafka.oauth.pwd} + + ssl.truststore.location=${kafka.properties.ssl.truststore.location} + ssl.truststore.password=${kafka.properties.ssl.truststore.password} +