Class NatsServer

  • All Implemented Interfaces:
    org.springframework.beans.factory.DisposableBean

    public class NatsServer
    extends berlin.yuna.natsserver.logic.Nats
    implements org.springframework.beans.factory.DisposableBean
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String BEAN_NAME  
      • Fields inherited from class berlin.yuna.natsserver.logic.Nats

        LOG, name, OPERATING_SYSTEM, pid, TMP_DIR
    • Constructor Summary

      Constructors 
      Constructor Description
      NatsServer​(long timeoutMs)
      Create NatsServer with simplest start able configuration
      NatsServer​(long timeoutMs, String... natsServerConfig)
      Create custom NatsServer with simplest configuration NatsServer#setConfig(String...)
    • Field Detail

      • BEAN_NAME

        public static final String BEAN_NAME
    • Constructor Detail

      • NatsServer

        public NatsServer​(long timeoutMs,
                          String... natsServerConfig)
        Create custom NatsServer with simplest configuration NatsServer#setConfig(String...)
        Parameters:
        timeoutMs - tear down timeout
        natsServerConfig - passes the original parameters to the server. example: port:4222, user:admin, password:admin
      • NatsServer

        public NatsServer​(long timeoutMs)
        Create NatsServer with simplest start able configuration
        Parameters:
        timeoutMs - tear down timeout
    • Method Detail

      • port

        public NatsServer port​(int port)
        Sets the port out of the configuration
        Overrides:
        port in class berlin.yuna.natsserver.logic.Nats
        Parameters:
        port - -1 for random port
        Returns:
        NatsServer
        Throws:
        RuntimeException - with ConnectException when there is no port configured
      • source

        public NatsServer source​(String natsServerUrl)
        Url to find nats server source
        Overrides:
        source in class berlin.yuna.natsserver.logic.Nats
        Parameters:
        natsServerUrl - url of the source NatsSourceConfig
        Returns:
        NatsServer
      • getNatsServerPath

        protected Path getNatsServerPath​(berlin.yuna.clu.logic.SystemUtil.OperatingSystem operatingSystem)
        Overrides:
        getNatsServerPath in class berlin.yuna.natsserver.logic.Nats
      • destroy

        public void destroy()
        Simply stops the NatsServer
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        See Also:
        Nats.stop()