Package io.micronaut.nats.connect
Class NatsConnectionFactoryConfig
java.lang.Object
io.micronaut.nats.connect.NatsConnectionFactoryConfig
@Requires(property="nats")
@EachProperty(value="nats",
primary="default")
public class NatsConnectionFactoryConfig
extends Object
Base class for nats to be configured.
- Since:
- 1.0.0
- Author:
- jgrimm
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classManages the jetstream configuration.static classTLS Configuration. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget the optional jetstream configuration.intgetName()longgetToken()booleanisNoEcho()booleanvoidsetAddresses(@Nullable List<String> addresses) voidsetConnectionTimeout(Duration connectionTimeout) voidsetCredentials(String credentials) voidsetInboxPrefix(String inboxPrefix) voidsetJetstream(@Nullable NatsConnectionFactoryConfig.JetStreamConfiguration jetstream) voidsetMaxReconnect(int maxReconnect) voidsetNoEcho(boolean noEcho) voidsetPassword(@Nullable String password) voidsetPingInterval(Duration pingInterval) voidsetReconnectBufferSize(long reconnectBufferSize) voidsetReconnectWait(Duration reconnectWait) voidvoidvoidsetUsername(@Nullable String username) voidsetUtf8Support(boolean utf8Support) io.nats.client.Options.Builder
-
Field Details
-
PREFIX
- See Also:
-
-
Constructor Details
-
NatsConnectionFactoryConfig
Default constructor.- Parameters:
name- The name of the configuration
-
-
Method Details
-
getName
- Returns:
- The name qualifier
-
getAddresses
- Returns:
- An optional list of addresses
-
setAddresses
- Parameters:
addresses- The list of addresses
-
getUsername
- Returns:
- the username for the connection
-
setUsername
- Parameters:
username- the username
-
getPassword
- Returns:
- the password for the connection
-
setPassword
- Parameters:
password- the password
-
getToken
- Returns:
- the token for the connection
-
setToken
- Parameters:
token- the token
-
getMaxReconnect
public int getMaxReconnect()- Returns:
- the max reconnection tries
-
setMaxReconnect
public void setMaxReconnect(int maxReconnect) - Parameters:
maxReconnect- times to try reconnect
-
getReconnectWait
- Returns:
- time to wait between reconnect attempts
-
setReconnectWait
- Parameters:
reconnectWait- time to wait
-
getConnectionTimeout
- Returns:
- maximum time for initial connection
-
setConnectionTimeout
- Parameters:
connectionTimeout- maximumTime for inital connection
-
getPingInterval
- Returns:
- time between ping intervals
-
setPingInterval
- Parameters:
pingInterval- time between server pings
-
getReconnectBufferSize
public long getReconnectBufferSize()- Returns:
- size of the buffer, in bytes, used to store publish messages during reconnect
-
setReconnectBufferSize
public void setReconnectBufferSize(long reconnectBufferSize) - Parameters:
reconnectBufferSize- size of the buffer, in bytes, used to store publish messages during reconnect
-
getInboxPrefix
- Returns:
- prefix to use for request/reply inboxes
-
setInboxPrefix
- Parameters:
inboxPrefix- custom prefix for request/reply inboxes
-
isNoEcho
public boolean isNoEcho()- Returns:
- whether or not to block echo messages, messages that were sent by this connection
-
setNoEcho
public void setNoEcho(boolean noEcho) - Parameters:
noEcho- enable or disable echo messages, messages that are sent by this connection back to this connection
-
isUtf8Support
public boolean isUtf8Support()- Returns:
- whether or not the client should support for UTF8 subject names
-
setUtf8Support
public void setUtf8Support(boolean utf8Support) - Parameters:
utf8Support- whether or not the client should support for UTF8 subject names
-
getCredentials
- Returns:
- path to the credentials file to use for authentication with an account enabled server
-
setCredentials
- Parameters:
credentials- path to the credentials file to use for authentication with an account enabled server
-
setTls
- Parameters:
tls- The tls configuration
-
toOptionsBuilder
public io.nats.client.Options.Builder toOptionsBuilder() throws IOException, GeneralSecurityException- Returns:
- NATS options builder based on this set of properties, useful if other settings are required before connect is called
- Throws:
IOException- if there is a problem reading a file or setting up the SSL contextGeneralSecurityException- if there is a problem setting up the SSL context
-
getJetstream
get the optional jetstream configuration.- Returns:
- the jetstream configuration
-
setJetstream
public void setJetstream(@Nullable @Nullable NatsConnectionFactoryConfig.JetStreamConfiguration jetstream) - Parameters:
jetstream- the jestream configuration
-