Package org.apache.pulsar.client.admin
Interface PulsarAdminBuilder
-
public interface PulsarAdminBuilderBuilder class for aPulsarAdmininstance.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PulsarAdminBuilderallowTlsInsecureConnection(boolean allowTlsInsecureConnection)Configure whether the Pulsar admin client accept untrusted TLS certificate from broker (default: false).PulsarAdminBuilderauthentication(java.lang.String authPluginClassName, java.lang.String authParamsString)Set the authentication provider to use in the Pulsar client instance.PulsarAdminBuilderauthentication(java.lang.String authPluginClassName, java.util.Map<java.lang.String,java.lang.String> authParams)Set the authentication provider to use in the Pulsar client instance.PulsarAdminBuilderauthentication(org.apache.pulsar.client.api.Authentication authentication)Set the authentication provider to use in the Pulsar admin instance.PulsarAdminBuilderautoCertRefreshTime(int autoCertRefreshTime, java.util.concurrent.TimeUnit autoCertRefreshTimeUnit)This sets auto cert refresh time if Pulsar admin uses tls authentication.PulsarAdminbuild()PulsarAdminBuilderclone()Create a copy of the current client builder.PulsarAdminBuilderconnectionTimeout(int connectionTimeout, java.util.concurrent.TimeUnit connectionTimeoutUnit)This sets the connection time out for the pulsar admin client.PulsarAdminBuilderenableTlsHostnameVerification(boolean enableTlsHostnameVerification)It allows to validate hostname verification when client connects to broker over TLS.PulsarAdminBuilderreadTimeout(int readTimeout, java.util.concurrent.TimeUnit readTimeoutUnit)This sets the server response read time out for the pulsar admin client for any request.PulsarAdminBuilderrequestTimeout(int requestTimeout, java.util.concurrent.TimeUnit requestTimeoutUnit)This sets the server request time out for the pulsar admin client for any request.PulsarAdminBuilderserviceHttpUrl(java.lang.String serviceHttpUrl)Set the Pulsar service HTTP URL for the admin endpoint (eg.PulsarAdminBuildersetContextClassLoader(java.lang.ClassLoader clientBuilderClassLoader)PulsarAdminBuildersslProvider(java.lang.String sslProvider)The name of the security provider used for SSL connections.PulsarAdminBuildertlsCiphers(java.util.Set<java.lang.String> tlsCiphers)A list of cipher suites.PulsarAdminBuildertlsProtocols(java.util.Set<java.lang.String> tlsProtocols)The SSL protocol used to generate the SSLContext.PulsarAdminBuildertlsTrustCertsFilePath(java.lang.String tlsTrustCertsFilePath)Set the path to the trusted TLS certificate file.PulsarAdminBuildertlsTrustStorePassword(java.lang.String tlsTrustStorePassword)The store password for the key store file.PulsarAdminBuildertlsTrustStorePath(java.lang.String tlsTrustStorePath)The location of the trust store file.PulsarAdminBuildertlsTrustStoreType(java.lang.String tlsTrustStoreType)The file format of the trust store file.PulsarAdminBuilderuseKeyStoreTls(boolean useKeyStoreTls)If Tls is enabled, whether use KeyStore type as tls configuration parameter.
-
-
-
Method Detail
-
build
PulsarAdmin build() throws org.apache.pulsar.client.api.PulsarClientException
- Returns:
- the new
PulsarAdmininstance - Throws:
org.apache.pulsar.client.api.PulsarClientException
-
clone
PulsarAdminBuilder clone()
Create a copy of the current client builder. 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();
-
serviceHttpUrl
PulsarAdminBuilder serviceHttpUrl(java.lang.String serviceHttpUrl)
Set the Pulsar service HTTP URL for the admin endpoint (eg. "http://my-broker.example.com:8080", or "https://my-broker.example.com:8443" for TLS)
-
authentication
PulsarAdminBuilder authentication(java.lang.String authPluginClassName, java.lang.String authParamsString) throws org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException
Set the authentication provider to use in the Pulsar client instance. 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(); ....- Parameters:
authPluginClassName- name of the Authentication-Plugin you want to useauthParamsString- string which represents parameters for the Authentication-Plugin, e.g., "key1:val1,key2:val2"- Throws:
org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException- failed to instantiate specified Authentication-Plugin
-
authentication
PulsarAdminBuilder authentication(java.lang.String authPluginClassName, java.util.Map<java.lang.String,java.lang.String> authParams) throws org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException
Set the authentication provider to use in the Pulsar client instance. Example:String AUTH_CLASS = "org.apache.pulsar.client.impl.auth.AuthenticationTls"; Map<String, String> 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(); ....- Parameters:
authPluginClassName- name of the Authentication-Plugin you want to useauthParams- map which represents parameters for the Authentication-Plugin- Throws:
org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException- failed to instantiate specified Authentication-Plugin
-
authentication
PulsarAdminBuilder authentication(org.apache.pulsar.client.api.Authentication authentication)
Set the authentication provider to use in the Pulsar admin instance. Example:String AUTH_CLASS = "org.apache.pulsar.client.impl.auth.AuthenticationTls"; Map<String, String> 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(); ....- Parameters:
authentication- an instance of theAuthenticationprovider already constructed
-
tlsTrustCertsFilePath
PulsarAdminBuilder tlsTrustCertsFilePath(java.lang.String tlsTrustCertsFilePath)
Set the path to the trusted TLS certificate file.- Parameters:
tlsTrustCertsFilePath-
-
allowTlsInsecureConnection
PulsarAdminBuilder allowTlsInsecureConnection(boolean allowTlsInsecureConnection)
Configure whether the Pulsar admin client accept untrusted TLS certificate from broker (default: false).- Parameters:
allowTlsInsecureConnection-
-
enableTlsHostnameVerification
PulsarAdminBuilder enableTlsHostnameVerification(boolean enableTlsHostnameVerification)
It allows to validate hostname verification when client connects to broker over TLS. It validates incoming x509 certificate and matches provided hostname(CN/SAN) with expected broker's host name. It follows RFC 2818, 3.1. Server Identity hostname verification.- Parameters:
enableTlsHostnameVerification-- See Also:
- rfc2818
-
useKeyStoreTls
PulsarAdminBuilder useKeyStoreTls(boolean useKeyStoreTls)
If Tls is enabled, whether use KeyStore type as tls configuration parameter. False means use default pem type configuration.- Parameters:
useKeyStoreTls-
-
sslProvider
PulsarAdminBuilder sslProvider(java.lang.String sslProvider)
The name of the security provider used for SSL connections. Default value is the default security provider of the JVM.- Parameters:
sslProvider-
-
tlsTrustStoreType
PulsarAdminBuilder tlsTrustStoreType(java.lang.String tlsTrustStoreType)
The file format of the trust store file.- Parameters:
tlsTrustStoreType-
-
tlsTrustStorePath
PulsarAdminBuilder tlsTrustStorePath(java.lang.String tlsTrustStorePath)
The location of the trust store file.- Parameters:
tlsTrustStorePath-
-
tlsTrustStorePassword
PulsarAdminBuilder tlsTrustStorePassword(java.lang.String tlsTrustStorePassword)
The store password for the key store file.- Parameters:
tlsTrustStorePassword-- Returns:
- the client builder instance
-
tlsCiphers
PulsarAdminBuilder tlsCiphers(java.util.Set<java.lang.String> tlsCiphers)
A list of cipher suites. This is a named combination of authentication, encryption, MAC and key exchange algorithm used to negotiate the security settings for a network connection using TLS or SSL network protocol. By default all the available cipher suites are supported.- Parameters:
tlsCiphers-
-
tlsProtocols
PulsarAdminBuilder tlsProtocols(java.util.Set<java.lang.String> tlsProtocols)
The SSL protocol used to generate the SSLContext. Default setting is TLS, which is fine for most cases. Allowed values in recent JVMs are TLS, TLSv1.3, TLSv1.2 and TLSv1.1.- Parameters:
tlsProtocols-
-
connectionTimeout
PulsarAdminBuilder connectionTimeout(int connectionTimeout, java.util.concurrent.TimeUnit connectionTimeoutUnit)
This sets the connection time out for the pulsar admin client.- Parameters:
connectionTimeout-connectionTimeoutUnit-
-
readTimeout
PulsarAdminBuilder readTimeout(int readTimeout, java.util.concurrent.TimeUnit readTimeoutUnit)
This sets the server response read time out for the pulsar admin client for any request.- Parameters:
readTimeout-readTimeoutUnit-
-
requestTimeout
PulsarAdminBuilder requestTimeout(int requestTimeout, java.util.concurrent.TimeUnit requestTimeoutUnit)
This sets the server request time out for the pulsar admin client for any request.- Parameters:
requestTimeout-requestTimeoutUnit-
-
autoCertRefreshTime
PulsarAdminBuilder autoCertRefreshTime(int autoCertRefreshTime, java.util.concurrent.TimeUnit autoCertRefreshTimeUnit)
This sets auto cert refresh time if Pulsar admin uses tls authentication.- Parameters:
autoCertRefreshTime-autoCertRefreshTimeUnit-
-
setContextClassLoader
PulsarAdminBuilder setContextClassLoader(java.lang.ClassLoader clientBuilderClassLoader)
- Returns:
-
-