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

liuyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 70550014c3c [fix][doc]: add the primary auth config on cluster 
failover example  (#620)
70550014c3c is described below

commit 70550014c3cbaa8fc0f891c588541c381b368cbb
Author: Eric Shen <[email protected]>
AuthorDate: Mon Jul 24 10:50:21 2023 +0800

    [fix][doc]: add the primary auth config on cluster failover example  (#620)
---
 docs/client-libraries-cluster-level-failover.md                   | 7 +++++++
 versioned_docs/version-2.10.x/client-libraries-java.md            | 8 ++++++++
 versioned_docs/version-2.11.x/client-libraries-java.md            | 8 ++++++++
 .../version-3.0.x/client-libraries-cluster-level-failover.md      | 7 +++++++
 4 files changed, 30 insertions(+)

diff --git a/docs/client-libraries-cluster-level-failover.md 
b/docs/client-libraries-cluster-level-failover.md
index 667deefc63a..e84acc436b0 100644
--- a/docs/client-libraries-cluster-level-failover.md
+++ b/docs/client-libraries-cluster-level-failover.md
@@ -38,7 +38,12 @@ This is an example of how to construct a Java Pulsar client 
to use automatic clu
 private PulsarClient getAutoFailoverClient() throws PulsarClientException {
     String primaryUrl = "pulsar+ssl://localhost:6651";
     String secondaryUrl = "pulsar+ssl://localhost:6661";
+    String primaryTlsTrustCertsFilePath = "primary/path";
     String secondaryTlsTrustCertsFilePath = "secondary/path";
+    Authentication primaryAuthentication = AuthenticationFactory.create(
+        "org.apache.pulsar.client.impl.auth.AuthenticationTls",
+        "tlsCertFile:/path/to/primary-my-role.cert.pem,"
+                + "tlsKeyFile:/path/to/primary-role.key-pk8.pem");
     Authentication secondaryAuthentication = AuthenticationFactory.create(
         "org.apache.pulsar.client.impl.auth.AuthenticationTls",
         "tlsCertFile:/path/to/secondary-my-role.cert.pem,"
@@ -60,6 +65,8 @@ private PulsarClient getAutoFailoverClient() throws 
PulsarClientException {
         .build();
 
     PulsarClient pulsarClient = PulsarClient.builder()
+        .authentication(primaryAuthentication) 
+        .tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
         .build();
 
     failover.initialize(pulsarClient);
diff --git a/versioned_docs/version-2.10.x/client-libraries-java.md 
b/versioned_docs/version-2.10.x/client-libraries-java.md
index 4c5d744eb5f..6b5e81b49da 100644
--- a/versioned_docs/version-2.10.x/client-libraries-java.md
+++ b/versioned_docs/version-2.10.x/client-libraries-java.md
@@ -346,6 +346,12 @@ private PulsarClient getAutoFailoverClient() throws 
PulsarClientException {
     String primaryUrl = "pulsar+ssl://localhost:6651";
     String secondaryUrl = "pulsar+ssl://localhost:6661";
 
+    String primaryTlsTrustCertsFilePath = "primary/path";
+    Authentication primaryAuthentication = AuthenticationFactory.create(
+        "org.apache.pulsar.client.impl.auth.AuthenticationTls",
+        "tlsCertFile:/path/to/primary-my-role.cert.pem,"
+                + "tlsKeyFile:/path/to/primary-role.key-pk8.pem");
+
     String secondaryTlsTrustCertsFilePath = "secondary/path";
     Authentication secondaryAuthentication = AuthenticationFactory.create(
         "org.apache.pulsar.client.impl.auth.AuthenticationTls",
@@ -370,6 +376,8 @@ private PulsarClient getAutoFailoverClient() throws 
PulsarClientException {
         .build();
 
     PulsarClient pulsarClient = PulsarClient.builder()
+        .authentication(primaryAuthentication) 
+        .tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
         .build();
 
     failover.initialize(pulsarClient);
diff --git a/versioned_docs/version-2.11.x/client-libraries-java.md 
b/versioned_docs/version-2.11.x/client-libraries-java.md
index f3aa79209b9..d0b36370188 100644
--- a/versioned_docs/version-2.11.x/client-libraries-java.md
+++ b/versioned_docs/version-2.11.x/client-libraries-java.md
@@ -1208,6 +1208,12 @@ private PulsarClient getAutoFailoverClient() throws 
PulsarClientException {
     String primaryUrl = "pulsar+ssl://localhost:6651";
     String secondaryUrl = "pulsar+ssl://localhost:6661";
 
+    String primaryTlsTrustCertsFilePath = "primary/path";
+    Authentication primaryAuthentication = AuthenticationFactory.create(
+        "org.apache.pulsar.client.impl.auth.AuthenticationTls",
+        "tlsCertFile:/path/to/primary-my-role.cert.pem,"
+                + "tlsKeyFile:/path/to/primary-role.key-pk8.pem");
+
     String secondaryTlsTrustCertsFilePath = "secondary/path";
     Authentication secondaryAuthentication = AuthenticationFactory.create(
         "org.apache.pulsar.client.impl.auth.AuthenticationTls",
@@ -1232,6 +1238,8 @@ private PulsarClient getAutoFailoverClient() throws 
PulsarClientException {
         .build();
 
     PulsarClient pulsarClient = PulsarClient.builder()
+        .authentication(primaryAuthentication) 
+        .tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
         .build();
 
     failover.initialize(pulsarClient);
diff --git 
a/versioned_docs/version-3.0.x/client-libraries-cluster-level-failover.md 
b/versioned_docs/version-3.0.x/client-libraries-cluster-level-failover.md
index 667deefc63a..e84acc436b0 100644
--- a/versioned_docs/version-3.0.x/client-libraries-cluster-level-failover.md
+++ b/versioned_docs/version-3.0.x/client-libraries-cluster-level-failover.md
@@ -38,7 +38,12 @@ This is an example of how to construct a Java Pulsar client 
to use automatic clu
 private PulsarClient getAutoFailoverClient() throws PulsarClientException {
     String primaryUrl = "pulsar+ssl://localhost:6651";
     String secondaryUrl = "pulsar+ssl://localhost:6661";
+    String primaryTlsTrustCertsFilePath = "primary/path";
     String secondaryTlsTrustCertsFilePath = "secondary/path";
+    Authentication primaryAuthentication = AuthenticationFactory.create(
+        "org.apache.pulsar.client.impl.auth.AuthenticationTls",
+        "tlsCertFile:/path/to/primary-my-role.cert.pem,"
+                + "tlsKeyFile:/path/to/primary-role.key-pk8.pem");
     Authentication secondaryAuthentication = AuthenticationFactory.create(
         "org.apache.pulsar.client.impl.auth.AuthenticationTls",
         "tlsCertFile:/path/to/secondary-my-role.cert.pem,"
@@ -60,6 +65,8 @@ private PulsarClient getAutoFailoverClient() throws 
PulsarClientException {
         .build();
 
     PulsarClient pulsarClient = PulsarClient.builder()
+        .authentication(primaryAuthentication) 
+        .tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
         .build();
 
     failover.initialize(pulsarClient);

Reply via email to