-
public final class ClientConfig
This class is used for configuring the clients for nsq. Immutable properties must be set when creating the object and are sent to NSQ for feature specification or negotiation. Keep in mind that some features might require some configuration on the server-side and could be not available.
-
-
Field Summary
Fields Modifier and Type Field Description private final String
clientId
private final String
localHostname
private final Boolean
featureNegotiation
private final Integer
heartbeatInterval
private final Boolean
tls
private final Boolean
snappy
private final Boolean
deflate
private final Integer
deflateLevel
private final String
userAgent
private final Integer
msgTimeout
private final Integer
sampleRate
private transient ByteArray
authSecret
private transient Integer
readTimeout
private transient Integer
connectTimeout
private transient SSLSocketFactory
sslSocketFactory
-
Constructor Summary
Constructors Constructor Description ClientConfig(String clientId, String localHostname, Boolean featureNegotiation, Integer heartbeatInterval, Boolean tls, Boolean snappy, Boolean deflate, Integer deflateLevel, String userAgent, Integer msgTimeout, Integer sampleRate, ByteArray authSecret, Integer readTimeout, Integer connectTimeout, SSLSocketFactory sslSocketFactory)
-
Method Summary
Modifier and Type Method Description final String
getClientId()
An identifier used to disambiguate this client (i.e. final String
getLocalHostname()
The hostname where the client is deployed final Boolean
getFeatureNegotiation()
Boolean used to indicate that the client supports feature negotiation. final Integer
getHeartbeatInterval()
Milliseconds between heartbeats. final Boolean
getTls()
Enable TLS for this connection final Boolean
getSnappy()
Enable snappy compression for this connection. final Boolean
getDeflate()
Enable deflate compression for this connection. final Integer
getDeflateLevel()
Configure the deflate compression level for this connection. final String
getUserAgent()
A string identifying the agent for this client in the spirit of HTTP. final Integer
getMsgTimeout()
Configure the server-side message timeout in milliseconds for messages delivered to this client. final Integer
getSampleRate()
The sample rate for incoming data to deliver a percentage of all messages received to this connection. final ByteArray
getAuthSecret()
The secret used for authorization, if the server requires it. final Unit
setAuthSecret(ByteArray authSecret)
The secret used for authorization, if the server requires it. final Integer
getReadTimeout()
The read timeout for connection sockets and for awaiting responses from nsq. final Unit
setReadTimeout(Integer readTimeout)
The read timeout for connection sockets and for awaiting responses from nsq. final Integer
getConnectTimeout()
The timeout for establishing a connection. final Unit
setConnectTimeout(Integer connectTimeout)
The timeout for establishing a connection. final SSLSocketFactory
getSslSocketFactory()
Using this property, you can use custom SSL configurations, e.g. final Unit
setSslSocketFactory(SSLSocketFactory sslSocketFactory)
Using this property, you can use custom SSL configurations, e.g. -
-
Constructor Detail
-
ClientConfig
ClientConfig(String clientId, String localHostname, Boolean featureNegotiation, Integer heartbeatInterval, Boolean tls, Boolean snappy, Boolean deflate, Integer deflateLevel, String userAgent, Integer msgTimeout, Integer sampleRate, ByteArray authSecret, Integer readTimeout, Integer connectTimeout, SSLSocketFactory sslSocketFactory)
-
-
Method Detail
-
getClientId
final String getClientId()
An identifier used to disambiguate this client (i.e. something specific to the consumer)
-
getLocalHostname
final String getLocalHostname()
The hostname where the client is deployed
-
getFeatureNegotiation
final Boolean getFeatureNegotiation()
Boolean used to indicate that the client supports feature negotiation. If the server is capable, it will send back a JSON payload of supported features and metadata.
-
getHeartbeatInterval
final Integer getHeartbeatInterval()
Milliseconds between heartbeats.
Valid range:
1000 <= heartbeat_interval <= configured_max
(-1
disables heartbeats)
-
getDeflate
final Boolean getDeflate()
-
getDeflateLevel
final Integer getDeflateLevel()
Configure the deflate compression level for this connection.
Valid range:
1 <= deflate_level <= configured_max
Higher values mean better compression but more CPU usage for nsqd.
-
getUserAgent
final String getUserAgent()
A string identifying the agent for this client in the spirit of HTTP.
-
getMsgTimeout
final Integer getMsgTimeout()
Configure the server-side message timeout in milliseconds for messages delivered to this client.
-
getSampleRate
final Integer getSampleRate()
The sample rate for incoming data to deliver a percentage of all messages received to this connection. This only applies to subscribing connections. The valid range is between 0 and 99, where 0 means that all data is sent (this is the default). 1 means that 1% of the data is sent.
-
getAuthSecret
final ByteArray getAuthSecret()
The secret used for authorization, if the server requires it. This value will be ignored if the server does not require authorization.
-
setAuthSecret
final Unit setAuthSecret(ByteArray authSecret)
The secret used for authorization, if the server requires it. This value will be ignored if the server does not require authorization.
-
getReadTimeout
final Integer getReadTimeout()
The read timeout for connection sockets and for awaiting responses from nsq.
-
setReadTimeout
final Unit setReadTimeout(Integer readTimeout)
The read timeout for connection sockets and for awaiting responses from nsq.
-
getConnectTimeout
final Integer getConnectTimeout()
The timeout for establishing a connection.
-
setConnectTimeout
final Unit setConnectTimeout(Integer connectTimeout)
The timeout for establishing a connection.
-
getSslSocketFactory
final SSLSocketFactory getSslSocketFactory()
Using this property, you can use custom SSL configurations, e.g. self signed certificates.
-
setSslSocketFactory
final Unit setSslSocketFactory(SSLSocketFactory sslSocketFactory)
Using this property, you can use custom SSL configurations, e.g. self signed certificates.
-
-
-
-