Package org.apache.pulsar.client.api
Interface ServiceUrlProvider
- All Superinterfaces:
AutoCloseable
The provider to provide the service url.
This allows applications to retrieve the service URL from an external configuration provider and, more importantly, to force the Pulsar client to reconnect if the service URL has been changed.
It can be passed with ClientBuilder.serviceUrlProvider(ServiceUrlProvider)
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Close the resource that the provider allocated.Get the current service URL the Pulsar client should connect to.void
initialize
(PulsarClient client) Initialize the service url provider with Pulsar client instance.
-
Method Details
-
initialize
Initialize the service url provider with Pulsar client instance.This can be used by the provider to force the Pulsar client to reconnect whenever the service url might have changed. See
PulsarClient.updateServiceUrl(String)
.- Parameters:
client
- created pulsar client.
-
getServiceUrl
String getServiceUrl()Get the current service URL the Pulsar client should connect to.- Returns:
- the pulsar service url.
-
close
Close the resource that the provider allocated.- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-