Skip to content

Commit

Permalink
Added the required serviceUrlProvider method for building PulsarClien…
Browse files Browse the repository at this point in the history
…t. (#891)
  • Loading branch information
sandeep-mst authored Apr 28, 2024
1 parent 0a2cd81 commit c86ecf3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
6 changes: 4 additions & 2 deletions docs/client-libraries-cluster-level-failover.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ private PulsarClient getAutoFailoverClient() throws PulsarClientException {
.build();

PulsarClient pulsarClient = PulsarClient.builder()
.authentication(primaryAuthentication)
.serviceUrlProvider(failover)
.authentication(primaryAuthentication)
.tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
.build();

Expand Down Expand Up @@ -113,6 +114,7 @@ public PulsarClient getControlledFailoverClient() throws IOException {

PulsarClient pulsarClient =
PulsarClient.builder()
.serviceUrlProvider(provider)
.build();

provider.initialize(pulsarClient);
Expand Down Expand Up @@ -155,4 +157,4 @@ Assume that you want to connect Pulsar client 1 to cluster A.
}
```

3. Pulsar client 1 connects to cluster A using credential *c1*.
3. Pulsar client 1 connects to cluster A using credential *c1*.
7 changes: 5 additions & 2 deletions versioned_docs/version-2.10.x/client-libraries-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ private PulsarClient getAutoFailoverClient() throws PulsarClientException {
.build();
PulsarClient pulsarClient = PulsarClient.builder()
.authentication(primaryAuthentication)
.serviceUrlProvider(failover)
.authentication(primaryAuthentication)
.tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
.build();
Expand Down Expand Up @@ -419,7 +420,9 @@ public PulsarClient getControlledFailoverClient() throws IOException {
.urlProviderHeader(header)
.build();
PulsarClient pulsarClient = PulsarClient.builder().build();
PulsarClient pulsarClient = PulsarClient.builder()
.serviceUrlProvider(provider)
.build();
provider.initialize(pulsarClient);
return pulsarClient;
Expand Down
7 changes: 5 additions & 2 deletions versioned_docs/version-2.11.x/client-libraries-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,8 @@ private PulsarClient getAutoFailoverClient() throws PulsarClientException {
.build();
PulsarClient pulsarClient = PulsarClient.builder()
.authentication(primaryAuthentication)
.serviceUrlProvider(failover)
.authentication(primaryAuthentication)
.tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
.build();
Expand Down Expand Up @@ -1281,7 +1282,9 @@ public PulsarClient getControlledFailoverClient() throws IOException {
.urlProviderHeader(header)
.build();
PulsarClient pulsarClient = PulsarClient.builder().build();
PulsarClient pulsarClient = PulsarClient.builder()
.serviceUrlProvider(provider)
.build();
provider.initialize(pulsarClient);
return pulsarClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ private PulsarClient getAutoFailoverClient() throws PulsarClientException {
.build();

PulsarClient pulsarClient = PulsarClient.builder()
.authentication(primaryAuthentication)
.serviceUrlProvider(failover)
.authentication(primaryAuthentication)
.tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
.build();

Expand Down Expand Up @@ -112,6 +113,7 @@ public PulsarClient getControlledFailoverClient() throws IOException {

PulsarClient pulsarClient =
PulsarClient.builder()
.serviceUrlProvider(provider)
.build();

provider.initialize(pulsarClient);
Expand Down Expand Up @@ -154,4 +156,4 @@ Assume that you want to connect Pulsar client 1 to cluster A.
}
```

3. Pulsar client 1 connects to cluster A using credential *c1*.
3. Pulsar client 1 connects to cluster A using credential *c1*.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ private PulsarClient getAutoFailoverClient() throws PulsarClientException {
.build();

PulsarClient pulsarClient = PulsarClient.builder()
.authentication(primaryAuthentication)
.serviceUrlProvider(failover)
.authentication(primaryAuthentication)
.tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
.build();

Expand Down Expand Up @@ -112,6 +113,7 @@ public PulsarClient getControlledFailoverClient() throws IOException {

PulsarClient pulsarClient =
PulsarClient.builder()
.serviceUrlProvider(provider)
.build();

provider.initialize(pulsarClient);
Expand Down Expand Up @@ -154,4 +156,4 @@ Assume that you want to connect Pulsar client 1 to cluster A.
}
```

3. Pulsar client 1 connects to cluster A using credential *c1*.
3. Pulsar client 1 connects to cluster A using credential *c1*.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ private PulsarClient getAutoFailoverClient() throws PulsarClientException {
.build();

PulsarClient pulsarClient = PulsarClient.builder()
.authentication(primaryAuthentication)
.serviceUrlProvider(failover)
.authentication(primaryAuthentication)
.tlsTrustCertsFilePath(primaryTlsTrustCertsFilePath)
.build();

Expand Down Expand Up @@ -113,6 +114,7 @@ public PulsarClient getControlledFailoverClient() throws IOException {

PulsarClient pulsarClient =
PulsarClient.builder()
.serviceUrlProvider(provider)
.build();

provider.initialize(pulsarClient);
Expand Down Expand Up @@ -155,4 +157,4 @@ Assume that you want to connect Pulsar client 1 to cluster A.
}
```

3. Pulsar client 1 connects to cluster A using credential *c1*.
3. Pulsar client 1 connects to cluster A using credential *c1*.

0 comments on commit c86ecf3

Please sign in to comment.