Skip to content

Commit cdab2d6

Browse files
authored
[fix] Initialize UrlServiceProvider before trying to use transaction coordinator (#23914)
1 parent 12b0579 commit cdab2d6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientBuilderImpl.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ public PulsarClient build() throws PulsarClientException {
6868
if (conf.getAuthentication() == null || conf.getAuthentication() == AuthenticationDisabled.INSTANCE) {
6969
setAuthenticationFromPropsIfAvailable(conf);
7070
}
71-
PulsarClient client = new PulsarClientImpl(conf);
72-
if (conf.getServiceUrlProvider() != null) {
73-
conf.getServiceUrlProvider().initialize(client);
74-
}
75-
return client;
71+
return new PulsarClientImpl(conf);
7672
}
7773

7874
@Override

pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ private PulsarClientImpl(ClientConfigurationData conf, EventLoopGroup eventLoopG
247247
this.timer = timer;
248248
}
249249

250+
if (conf.getServiceUrlProvider() != null) {
251+
conf.getServiceUrlProvider().initialize(this);
252+
}
253+
250254
if (conf.isEnableTransaction()) {
251255
tcClient = new TransactionCoordinatorClientImpl(this);
252256
try {

0 commit comments

Comments
 (0)