Package org.apache.pulsar.client.api
Class ClientConfiguration
java.lang.Object
org.apache.pulsar.client.api.ClientConfiguration
- All Implemented Interfaces:
Serializable
Deprecated.
Class used to specify client side configuration like authentication, etc..
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pulsar.client.api.AuthenticationDeprecated.intDeprecated.Get configured total allowed concurrent lookup-request.org.apache.pulsar.client.impl.conf.ClientConfigurationDataDeprecated.intDeprecated.longDeprecated.Get the duration of time for which the client will wait for a connection to a broker to be established before giving up.intDeprecated.intDeprecated.intDeprecated.Get configured max number of reject-request in a time-frame (60 seconds) after which connection will be closed.longDeprecated.longDeprecated.Stats will be activated with positive statsIntervalSeconds.Deprecated.booleanDeprecated.booleanDeprecated.booleanDeprecated.booleanisUseTls()Deprecated.voidsetAuthentication(String authPluginClassName, String authParamsString) Deprecated.Set the authentication provider to use in the Pulsar client instance.voidsetAuthentication(String authPluginClassName, Map<String, String> authParams) Deprecated.Set the authentication provider to use in the Pulsar client instance.voidsetAuthentication(org.apache.pulsar.client.api.Authentication authentication) Deprecated.Set the authentication provider to use in the Pulsar client instance.voidsetConcurrentLookupRequest(int concurrentLookupRequest) Deprecated.Number of concurrent lookup-requests allowed on each broker-connection to prevent overload on broker.voidsetConnectionsPerBroker(int connectionsPerBroker) Deprecated.Sets the max number of connection that the client library will open to a single broker.voidsetConnectionTimeout(int duration, TimeUnit unit) Deprecated.Set the duration of time to wait for a connection to a broker to be established.voidsetIoThreads(int numIoThreads) Deprecated.Set the number of threads to be used for handling connections to brokers (default: 1 thread).voidsetListenerThreads(int numListenerThreads) Deprecated.Set the number of threads to be used for message listeners (default: 1 thread).voidsetMaxNumberOfRejectedRequestPerConnection(int maxNumberOfRejectedRequestPerConnection) Deprecated.Set max number of broker-rejected requests in a certain time-frame (60 seconds) after which current connection.voidsetOperationTimeout(int operationTimeout, TimeUnit unit) Deprecated.Set the operation timeout (default: 30 seconds).setServiceUrl(String serviceUrl) Deprecated.voidsetStatsInterval(long statsInterval, TimeUnit unit) Deprecated.Set the interval between each stat info (default: 60 seconds) Stats will be activated with positive.voidsetTlsAllowInsecureConnection(boolean tlsAllowInsecureConnection) Deprecated.Configure whether the Pulsar client accept untrusted TLS certificate from broker (default: false).voidsetTlsHostnameVerificationEnable(boolean tlsHostnameVerificationEnable) Deprecated.It allows to validate hostname verification when client connects to broker over tls.voidsetTlsTrustCertsFilePath(String tlsTrustCertsFilePath) Deprecated.Set the path to the trusted TLS certificate file.voidsetUseTcpNoDelay(boolean useTcpNoDelay) Deprecated.Configure whether to use TCP no-delay flag on the connection, to disable Nagle algorithm.voidsetUseTls(boolean useTls) Deprecated.Configure whether to use TLS encryption on the connection (default: false).
-
Constructor Details
-
ClientConfiguration
public ClientConfiguration()Deprecated.
-
-
Method Details
-
getAuthentication
public org.apache.pulsar.client.api.Authentication getAuthentication()Deprecated.- Returns:
- the authentication provider to be used
-
setAuthentication
public void setAuthentication(org.apache.pulsar.client.api.Authentication authentication) Deprecated.Set the authentication provider to use in the Pulsar client instance.Example:
ClientConfiguration confData = new ClientConfiguration(); String authPluginClassName = "org.apache.pulsar.client.impl.auth.MyAuthentication"; String authParamsString = "key1:val1,key2:val2"; Authentication auth = AuthenticationFactory.create(authPluginClassName, authParamsString); confData.setAuthentication(auth); PulsarClient client = PulsarClient.create(serviceUrl, confData); ....- Parameters:
authentication-
-
setAuthentication
public void setAuthentication(String authPluginClassName, String authParamsString) throws org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException Deprecated.Set the authentication provider to use in the Pulsar client instance.Example:
ClientConfiguration confData = new ClientConfiguration(); String authPluginClassName = "org.apache.pulsar.client.impl.auth.MyAuthentication"; String authParamsString = "key1:val1,key2:val2"; confData.setAuthentication(authPluginClassName, authParamsString); PulsarClient client = PulsarClient.create(serviceUrl, confData); ....- 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
-
setAuthentication
public void setAuthentication(String authPluginClassName, Map<String, String> authParams) throws org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationExceptionDeprecated.Set the authentication provider to use in the Pulsar client instance.Example:
ClientConfiguration confData = new ClientConfiguration(); String authPluginClassName = "org.apache.pulsar.client.impl.auth.MyAuthentication"; Map<String, String> authParams = new HashMap<String, String>(); authParams.put("key1", "val1"); confData.setAuthentication(authPluginClassName, authParams); PulsarClient client = PulsarClient.create(serviceUrl, confData); ....- 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
-
getOperationTimeoutMs
public long getOperationTimeoutMs()Deprecated.- Returns:
- the operation timeout in ms
-
setOperationTimeout
Deprecated.Set the operation timeout (default: 30 seconds).Producer-create, subscribe and unsubscribe operations will be retried until this interval, after which the operation will be marked as failed
- Parameters:
operationTimeout- operation timeoutunit- time unit foroperationTimeout
-
getIoThreads
public int getIoThreads()Deprecated.- Returns:
- the number of threads to use for handling connections
-
setIoThreads
public void setIoThreads(int numIoThreads) Deprecated.Set the number of threads to be used for handling connections to brokers (default: 1 thread).- Parameters:
numIoThreads-
-
getListenerThreads
public int getListenerThreads()Deprecated.- Returns:
- the number of threads to use for message listeners
-
setListenerThreads
public void setListenerThreads(int numListenerThreads) Deprecated.Set the number of threads to be used for message listeners (default: 1 thread).- Parameters:
numListenerThreads-
-
getConnectionsPerBroker
public int getConnectionsPerBroker()Deprecated.- Returns:
- the max number of connections per single broker
-
setConnectionsPerBroker
public void setConnectionsPerBroker(int connectionsPerBroker) Deprecated.Sets the max number of connection that the client library will open to a single broker.By default, the connection pool will use a single connection for all the producers and consumers. Increasing this parameter may improve throughput when using many producers over a high latency connection.
- Parameters:
connectionsPerBroker- max number of connections per broker (needs to be greater than 0)
-
isUseTcpNoDelay
public boolean isUseTcpNoDelay()Deprecated.- Returns:
- whether TCP no-delay should be set on the connections
-
setUseTcpNoDelay
public void setUseTcpNoDelay(boolean useTcpNoDelay) Deprecated.Configure whether to use TCP no-delay flag on the connection, to disable Nagle algorithm.No-delay features make sure packets are sent out on the network as soon as possible, and it's critical to achieve low latency publishes. On the other hand, sending out a huge number of small packets might limit the overall throughput, so if latency is not a concern, it's advisable to set the
useTcpNoDelayflag to false.Default value is true
- Parameters:
useTcpNoDelay-
-
isUseTls
public boolean isUseTls()Deprecated.- Returns:
- whether TLS encryption is used on the connection
-
setUseTls
public void setUseTls(boolean useTls) Deprecated.Configure whether to use TLS encryption on the connection (default: false).- Parameters:
useTls-
-
getTlsTrustCertsFilePath
Deprecated.- Returns:
- path to the trusted TLS certificate file
-
setTlsTrustCertsFilePath
Deprecated.Set the path to the trusted TLS certificate file.- Parameters:
tlsTrustCertsFilePath-
-
isTlsAllowInsecureConnection
public boolean isTlsAllowInsecureConnection()Deprecated.- Returns:
- whether the Pulsar client accept untrusted TLS certificate from broker
-
setTlsAllowInsecureConnection
public void setTlsAllowInsecureConnection(boolean tlsAllowInsecureConnection) Deprecated.Configure whether the Pulsar client accept untrusted TLS certificate from broker (default: false).- Parameters:
tlsAllowInsecureConnection-
-
getStatsIntervalSeconds
public long getStatsIntervalSeconds()Deprecated.Stats will be activated with positive statsIntervalSeconds.- Returns:
- the interval between each stat info (default: 60 seconds)
-
setStatsInterval
Deprecated.Set the interval between each stat info (default: 60 seconds) Stats will be activated with positive. statsIntervalSeconds It should be set to at least 1 second- Parameters:
statsInterval- the interval between each stat infounit- time unit forstatsInterval
-
getConcurrentLookupRequest
public int getConcurrentLookupRequest()Deprecated.Get configured total allowed concurrent lookup-request.- Returns:
-
setConcurrentLookupRequest
public void setConcurrentLookupRequest(int concurrentLookupRequest) Deprecated.Number of concurrent lookup-requests allowed on each broker-connection to prevent overload on broker. (default: 50000) It should be configured with higher value only in case of it requires to produce/subscribe on thousands of topic using createdPulsarClient- Parameters:
concurrentLookupRequest-
-
getMaxNumberOfRejectedRequestPerConnection
public int getMaxNumberOfRejectedRequestPerConnection()Deprecated.Get configured max number of reject-request in a time-frame (60 seconds) after which connection will be closed.- Returns:
-
setMaxNumberOfRejectedRequestPerConnection
public void setMaxNumberOfRejectedRequestPerConnection(int maxNumberOfRejectedRequestPerConnection) Deprecated.Set max number of broker-rejected requests in a certain time-frame (60 seconds) after which current connection. will be closed and client creates a new connection that give chance to connect a different broker (default: 50)- Parameters:
maxNumberOfRejectedRequestPerConnection-
-
isTlsHostnameVerificationEnable
public boolean isTlsHostnameVerificationEnable()Deprecated. -
setTlsHostnameVerificationEnable
public void setTlsHostnameVerificationEnable(boolean tlsHostnameVerificationEnable) Deprecated.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:
tlsHostnameVerificationEnable-- See Also:
-
setServiceUrl
Deprecated. -
setConnectionTimeout
Deprecated.Set the duration of time to wait for a connection to a broker to be established. If the duration passes without a response from the broker, the connection attempt is dropped.- Parameters:
duration- the duration to waitunit- the time unit in which the duration is defined
-
getConnectionTimeoutMs
public long getConnectionTimeoutMs()Deprecated.Get the duration of time for which the client will wait for a connection to a broker to be established before giving up.- Returns:
- the duration, in milliseconds
-
getConfigurationData
public org.apache.pulsar.client.impl.conf.ClientConfigurationData getConfigurationData()Deprecated.
-
PulsarClient#builder()to construct and configure a newPulsarClientinstance