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
  • Field Details

  • Constructor Details

    • NatsConnectionFactoryConfig

      public NatsConnectionFactoryConfig(@Parameter String name)
      Default constructor.
      Parameters:
      name - The name of the configuration
  • Method Details

    • getName

      public String getName()
      Returns:
      The name qualifier
    • getAddresses

      public Optional<List<String>> getAddresses()
      Returns:
      An optional list of addresses
    • setAddresses

      public void setAddresses(@Nullable @Nullable List<String> addresses)
      Parameters:
      addresses - The list of addresses
    • getUsername

      public Optional<String> getUsername()
      Returns:
      the username for the connection
    • setUsername

      public void setUsername(@Nullable @Nullable String username)
      Parameters:
      username - the username
    • getPassword

      public Optional<String> getPassword()
      Returns:
      the password for the connection
    • setPassword

      public void setPassword(@Nullable @Nullable String password)
      Parameters:
      password - the password
    • getToken

      public Optional<String> getToken()
      Returns:
      the token for the connection
    • setToken

      public void setToken(String token)
      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

      public Duration getReconnectWait()
      Returns:
      time to wait between reconnect attempts
    • setReconnectWait

      public void setReconnectWait(Duration reconnectWait)
      Parameters:
      reconnectWait - time to wait
    • getConnectionTimeout

      public Duration getConnectionTimeout()
      Returns:
      maximum time for initial connection
    • setConnectionTimeout

      public void setConnectionTimeout(Duration connectionTimeout)
      Parameters:
      connectionTimeout - maximumTime for inital connection
    • getPingInterval

      public Duration getPingInterval()
      Returns:
      time between ping intervals
    • setPingInterval

      public void setPingInterval(Duration pingInterval)
      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

      public String getInboxPrefix()
      Returns:
      prefix to use for request/reply inboxes
    • setInboxPrefix

      public void setInboxPrefix(String inboxPrefix)
      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

      public String getCredentials()
      Returns:
      path to the credentials file to use for authentication with an account enabled server
    • setCredentials

      public void setCredentials(String credentials)
      Parameters:
      credentials - path to the credentials file to use for authentication with an account enabled server
    • setTls

      public void setTls(@Nullable NatsConnectionFactoryConfig.TLS tls)
      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 context
      GeneralSecurityException - if there is a problem setting up the SSL context
    • getJetstream

      @Nullable public @Nullable NatsConnectionFactoryConfig.JetStreamConfiguration getJetstream()
      get the optional jetstream configuration.
      Returns:
      the jetstream configuration
    • setJetstream

      public void setJetstream(@Nullable @Nullable NatsConnectionFactoryConfig.JetStreamConfiguration jetstream)
      Parameters:
      jetstream - the jestream configuration