You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zi...@apache.org on 2022/08/02 03:18:46 UTC

[pulsar] branch branch-2.7 updated: [fix][broker] Fix create client with TLS config (#16326)

This is an automated email from the ASF dual-hosted git repository.

zixuan pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 86cb641da19 [fix][broker] Fix create client with TLS config (#16326)
86cb641da19 is described below

commit 86cb641da19c773e8b7618c6a476d57c58a680a5
Author: Zixuan Liu <no...@gmail.com>
AuthorDate: Tue Aug 2 11:18:40 2022 +0800

    [fix][broker] Fix create client with TLS config (#16326)
    
    Signed-off-by: Zixuan Liu <no...@gmail.com>
---
 .../src/main/java/org/apache/pulsar/broker/PulsarService.java     | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
index 4492c1d1e0b..f72a971a00a 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
@@ -1051,11 +1051,8 @@ public class PulsarService implements AutoCloseable {
         if (this.client == null) {
             try {
                 ClientBuilder builder = PulsarClient.builder()
-                    .serviceUrl(this.getConfiguration().isTlsEnabled()
-                                ? this.brokerServiceUrlTls : this.brokerServiceUrl)
-                    .enableTls(this.getConfiguration().isTlsEnabled())
-                    .allowTlsInsecureConnection(this.getConfiguration().isTlsAllowInsecureConnection())
-                    .tlsTrustCertsFilePath(this.getConfiguration().getTlsCertificateFilePath());
+                    .serviceUrl(this.getConfiguration().isBrokerClientTlsEnabled()
+                                ? this.brokerServiceUrlTls : this.brokerServiceUrl);
                 // Apply all arbitrary configuration. This must be called before setting any fields annotated as
                 // @Secret on the ClientConfigurationData object because of the way they are serialized.
                 // See https://github.com/apache/pulsar/issues/8509 for more information.
@@ -1064,6 +1061,7 @@ public class PulsarService implements AutoCloseable {
                 builder.loadConf(overrides);
 
                 if (this.getConfiguration().isBrokerClientTlsEnabled()) {
+                    builder.allowTlsInsecureConnection(this.getConfiguration().isTlsAllowInsecureConnection());
                     if (this.getConfiguration().isBrokerClientTlsEnabledWithKeyStore()) {
                         builder.useKeyStoreTls(true)
                                 .tlsTrustStoreType(this.getConfiguration().getBrokerClientTlsTrustStoreType())