public interface PulsarAdminBuilder
PulsarAdmin instance.| Modifier and Type | Method and Description |
|---|---|
PulsarAdminBuilder |
allowTlsInsecureConnection(boolean allowTlsInsecureConnection)
Configure whether the Pulsar admin client accept untrusted TLS certificate from broker (default: false)
|
PulsarAdminBuilder |
authentication(Authentication authentication)
Set the authentication provider to use in the Pulsar admin instance.
|
PulsarAdminBuilder |
authentication(String authPluginClassName,
Map<String,String> authParams)
Set the authentication provider to use in the Pulsar client instance.
|
PulsarAdminBuilder |
authentication(String authPluginClassName,
String authParamsString)
Set the authentication provider to use in the Pulsar client instance.
|
PulsarAdmin |
build() |
PulsarAdminBuilder |
clone()
Create a copy of the current client builder.
|
PulsarAdminBuilder |
enableTlsHostnameVerification(boolean enableTlsHostnameVerification)
It allows to validate hostname verification when client connects to broker over TLS.
|
PulsarAdminBuilder |
serviceHttpUrl(String serviceHttpUrl)
Set the Pulsar service HTTP URL for the admin endpoint (eg.
|
PulsarAdminBuilder |
tlsTrustCertsFilePath(String tlsTrustCertsFilePath)
Set the path to the trusted TLS certificate file
|
PulsarAdmin build() throws PulsarClientException
PulsarAdmin instancePulsarClientExceptionPulsarAdminBuilder clone()
Cloning the builder can be used to share an incomplete configuration and specialize it multiple times. For example:
PulsarAdminBuilder builder = PulsarAdmin.builder().allowTlsInsecureConnection(false); PulsarAdmin client1 = builder.clone().serviceHttpUrl(URL_1).build(); PulsarAdmin client2 = builder.clone().serviceHttpUrl(URL_2).build();
PulsarAdminBuilder serviceHttpUrl(String serviceHttpUrl)
PulsarAdminBuilder authentication(String authPluginClassName, String authParamsString) throws PulsarClientException.UnsupportedAuthenticationException
Example:
String AUTH_CLASS = "org.apache.pulsar.client.impl.auth.AuthenticationTls";
String AUTH_PARAMS = "tlsCertFile:/my/cert/file,tlsKeyFile:/my/key/file";
PulsarAdmin client = PulsarAdmin.builder()
.serviceHttpUrl(SERVICE_HTTP_URL)
.authentication(AUTH_CLASS, AUTH_PARAMS)
.build();
....
authPluginClassName - name of the Authentication-Plugin you want to useauthParamsString - string which represents parameters for the Authentication-Plugin, e.g., "key1:val1,key2:val2"PulsarClientException.UnsupportedAuthenticationException - failed to instantiate specified Authentication-PluginPulsarAdminBuilder authentication(String authPluginClassName, Map<String,String> authParams) throws PulsarClientException.UnsupportedAuthenticationException
Example:
String AUTH_CLASS = "org.apache.pulsar.client.impl.auth.AuthenticationTls";
Map conf = new TreeMap<>();
conf.put("tlsCertFile", "/my/cert/file");
conf.put("tlsKeyFile", "/my/key/file");
PulsarAdmin client = PulsarAdmin.builder()
.serviceHttpUrl(SERVICE_HTTP_URL)
.authentication(AUTH_CLASS, conf)
.build();
....
authPluginClassName - name of the Authentication-Plugin you want to useauthParams - map which represents parameters for the Authentication-PluginPulsarClientException.UnsupportedAuthenticationException - failed to instantiate specified Authentication-PluginPulsarAdminBuilder authentication(Authentication authentication)
Example:
String AUTH_CLASS = "org.apache.pulsar.client.impl.auth.AuthenticationTls";
Map conf = new TreeMap<>();
conf.put("tlsCertFile", "/my/cert/file");
conf.put("tlsKeyFile", "/my/key/file");
Authentication auth = AuthenticationFactor.create(AUTH_CLASS, conf);
PulsarAdmin admin = PulsarAdmin.builder()
.serviceHttpUrl(SERVICE_URL)
.authentication(auth)
.build();
....
authentication - an instance of the Authentication provider already constructedPulsarAdminBuilder tlsTrustCertsFilePath(String tlsTrustCertsFilePath)
tlsTrustCertsFilePath - PulsarAdminBuilder allowTlsInsecureConnection(boolean allowTlsInsecureConnection)
allowTlsInsecureConnection - PulsarAdminBuilder enableTlsHostnameVerification(boolean enableTlsHostnameVerification)
enableTlsHostnameVerification - Copyright © 2017–2018 Apache Software Foundation. All rights reserved.