public abstract class NatsRunnerUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONF_FILE_EXT |
static java.lang.String |
CONF_FILE_PREFIX |
static java.lang.String |
CONFIG_FILE_OPTION_NAME |
static java.lang.String |
CONFIG_PORT_KEY |
static int |
DEFAULT_CLUSTER_COUNT |
static java.lang.String |
DEFAULT_CLUSTER_NAME |
static java.lang.String |
DEFAULT_HOST |
static int |
DEFAULT_LISTEN_START |
static int |
DEFAULT_MONITOR_START |
static java.lang.String |
DEFAULT_NATS_SERVER |
static int |
DEFAULT_PORT_START |
static java.lang.String |
DEFAULT_SERVER_NAME_PREFIX |
static java.lang.String |
JETSTREAM_OPTION |
static java.lang.String |
LOCALHOST |
static java.lang.String |
NATS |
static java.lang.String |
NATS_PORT_KEY |
static java.lang.String |
NATS_SERVER_PATH_ENV |
static java.lang.String |
NON_NATS_PORT_KEY |
static java.lang.String |
PORT_MAPPED_REGEX |
static java.lang.String |
PORT_PROPERTY |
static java.lang.String |
PORT_REGEX |
static java.lang.String |
USER_PORT_KEY |
static java.lang.String |
VERSION_OPTION |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearServerPath()
Deprecated.
Use
NatsServerRunner.clearPreferredServerPath() instead |
static java.util.List<ClusterInsert> |
createClusterInserts() |
static java.util.List<ClusterInsert> |
createClusterInserts(int count) |
static java.util.List<ClusterInsert> |
createClusterInserts(int count,
java.nio.file.Path jsStoreDirBase) |
static java.util.List<ClusterInsert> |
createClusterInserts(int count,
java.lang.String clusterName,
java.lang.String serverNamePrefix) |
static java.util.List<ClusterInsert> |
createClusterInserts(int count,
java.lang.String clusterName,
java.lang.String serverNamePrefix,
boolean monitor) |
static java.util.List<ClusterInsert> |
createClusterInserts(int count,
java.lang.String clusterName,
java.lang.String serverNamePrefix,
boolean monitor,
java.nio.file.Path jsStoreDirBase) |
static java.util.List<ClusterInsert> |
createClusterInserts(int count,
java.lang.String clusterName,
java.lang.String serverNamePrefix,
java.nio.file.Path jsStoreDirBase) |
static java.util.List<ClusterInsert> |
createClusterInserts(java.util.List<ClusterNode> nodes) |
static java.util.List<ClusterInsert> |
createClusterInserts(java.nio.file.Path jsStoreDirBase) |
static java.util.List<ClusterNode> |
createNodes(int count,
java.lang.String clusterName,
java.lang.String serverNamePrefix,
boolean monitor,
java.nio.file.Path jsStoreDirBase) |
static java.util.List<ClusterNode> |
createNodes(int count,
java.lang.String clusterName,
java.lang.String serverNamePrefix,
java.nio.file.Path jsStoreDirBase,
java.lang.String host,
int portStart,
int listenStart,
java.lang.Integer monitorStart) |
static void |
defaultHost(java.lang.String defaultHost) |
static void |
defaultListenStart(int defaultListenStart) |
static void |
defaultMonitorStart(int defaultMonitorStart) |
static void |
defaultPortStart(int defaultPortStart) |
static java.lang.String |
getLocalhostUri(java.lang.String schema,
int port)
Build a schema://localhost:port uri
|
static java.lang.String |
getNatsLocalhostUri(int port)
Build a nats://localhost:port uri
|
static java.lang.String |
getNatsServerVersionString()
Get the version string from the nats server i.e.
|
static java.lang.String |
getNatsServerVersionString(java.lang.String serverPath)
Get the version string from the nats server i.e.
|
static java.lang.String |
getNatsUri(java.lang.String host,
int port)
Build a nats://host:port uri
|
static java.lang.String |
getResolvedServerPath()
Resolves the server executable path in this order:
Checking the "nats_server_path" environment variable
Checking the value set via
NatsServerRunner.setPreferredServerPath(java.lang.String) method
"nats-server"
|
static java.lang.String |
getUri(java.lang.String schema,
java.lang.String host,
int port)
Build a schema://host:port uri
|
static java.lang.String |
getURIForPort(int port)
Deprecated.
Use
getNatsLocalhostUri(int) instead. |
static int |
nextPort()
Get a port number automatically allocated by the system, typically from an ephemeral port range.
|
static void |
setServerPath(java.lang.String serverPath)
Deprecated.
|
public static final java.lang.String NATS_SERVER_PATH_ENV
public static final java.lang.String DEFAULT_NATS_SERVER
public static final java.lang.String CONFIG_FILE_OPTION_NAME
public static final java.lang.String VERSION_OPTION
public static final java.lang.String JETSTREAM_OPTION
public static final java.lang.String CONF_FILE_PREFIX
public static final java.lang.String CONF_FILE_EXT
public static final java.lang.String PORT_REGEX
public static final java.lang.String PORT_MAPPED_REGEX
public static final java.lang.String PORT_PROPERTY
public static final java.lang.String CONFIG_PORT_KEY
public static final java.lang.String USER_PORT_KEY
public static final java.lang.String NATS_PORT_KEY
public static final java.lang.String NON_NATS_PORT_KEY
public static final int DEFAULT_CLUSTER_COUNT
public static final java.lang.String DEFAULT_CLUSTER_NAME
public static final java.lang.String DEFAULT_SERVER_NAME_PREFIX
public static final java.lang.String NATS
public static final java.lang.String LOCALHOST
public static java.lang.String DEFAULT_HOST
public static int DEFAULT_PORT_START
public static int DEFAULT_LISTEN_START
public static int DEFAULT_MONITOR_START
@Deprecated public static java.lang.String getURIForPort(int port)
getNatsLocalhostUri(int) instead.port - the portpublic static java.lang.String getNatsLocalhostUri(int port)
port - the portpublic static java.lang.String getNatsUri(java.lang.String host,
int port)
host - the hostport - the portpublic static java.lang.String getLocalhostUri(java.lang.String schema,
int port)
schema - the schemaport - the portpublic static java.lang.String getUri(java.lang.String schema,
java.lang.String host,
int port)
schema - the schemahost - the hostport - the port@Deprecated public static void setServerPath(java.lang.String serverPath)
NatsServerRunner.setPreferredServerPath(java.lang.String) insteadserverPath - the fully qualified path of the server@Deprecated public static void clearServerPath()
NatsServerRunner.clearPreferredServerPath() insteadpublic static java.lang.String getResolvedServerPath()
NatsServerRunner.setPreferredServerPath(java.lang.String) methodpublic static int nextPort()
throws java.io.IOException
java.io.IOException - if there is a problem getting a portpublic static java.lang.String getNatsServerVersionString()
getResolvedServerPath()public static java.lang.String getNatsServerVersionString(java.lang.String serverPath)
serverPath - the specific server path to checkpublic static java.util.List<ClusterInsert> createClusterInserts() throws java.io.IOException
java.io.IOExceptionpublic static java.util.List<ClusterInsert> createClusterInserts(java.nio.file.Path jsStoreDirBase) throws java.io.IOException
java.io.IOExceptionpublic static java.util.List<ClusterInsert> createClusterInserts(int count) throws java.io.IOException
java.io.IOExceptionpublic static java.util.List<ClusterInsert> createClusterInserts(int count, java.nio.file.Path jsStoreDirBase) throws java.io.IOException
java.io.IOExceptionpublic static java.util.List<ClusterInsert> createClusterInserts(int count, java.lang.String clusterName, java.lang.String serverNamePrefix) throws java.io.IOException
java.io.IOExceptionpublic static java.util.List<ClusterInsert> createClusterInserts(int count, java.lang.String clusterName, java.lang.String serverNamePrefix, java.nio.file.Path jsStoreDirBase) throws java.io.IOException
java.io.IOExceptionpublic static java.util.List<ClusterInsert> createClusterInserts(int count, java.lang.String clusterName, java.lang.String serverNamePrefix, boolean monitor) throws java.io.IOException
java.io.IOExceptionpublic static java.util.List<ClusterInsert> createClusterInserts(int count, java.lang.String clusterName, java.lang.String serverNamePrefix, boolean monitor, java.nio.file.Path jsStoreDirBase) throws java.io.IOException
java.io.IOExceptionpublic static void defaultHost(java.lang.String defaultHost)
public static void defaultPortStart(int defaultPortStart)
public static void defaultListenStart(int defaultListenStart)
public static void defaultMonitorStart(int defaultMonitorStart)
public static java.util.List<ClusterNode> createNodes(int count, java.lang.String clusterName, java.lang.String serverNamePrefix, boolean monitor, java.nio.file.Path jsStoreDirBase)
public static java.util.List<ClusterNode> createNodes(int count, java.lang.String clusterName, java.lang.String serverNamePrefix, java.nio.file.Path jsStoreDirBase, java.lang.String host, int portStart, int listenStart, java.lang.Integer monitorStart)
public static java.util.List<ClusterInsert> createClusterInserts(java.util.List<ClusterNode> nodes)