public class Nats extends NatsBase
SystemUtil,
NatsNATS_PREFIX| Constructor and Description |
|---|
Nats()
Create
Nats without any start able configuration |
Nats(int port)
Create
Nats with the simplest start able configuration |
Nats(List<String> customArgs)
Create
Nats with custom args |
Nats(String... kv)
Create custom
Nats with the simplest configuration config(String...) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Map<NatsConfig,MapValue> |
config()
GetNatServerConfig
|
Nats |
config(Map<NatsConfig,String> config)
Configures the nats server
|
Nats |
config(NatsConfig key,
String value)
Configures the nats server
|
Nats |
config(String... kv)
Configures the nats server
|
Nats |
start()
Starts the server in
ProcessBuilder with the given config config(String...) |
Nats |
start(long timeoutMs)
Starts the server in
ProcessBuilder with the given config config(String...) |
Nats |
stop()
Stops the
ProcessBuilder and kills the Nats
Only a log error will occur if the Nats were never started |
Nats |
stop(long timeoutMs)
Stops the
ProcessBuilder and kills the Nats
Only a log error will occur if the Nats were never started |
Nats |
tryStart()
Starts the server in
ProcessBuilder with the given parameterConfig config(String...)
Throws all exceptions as RuntimeException |
Nats |
tryStart(long timeoutMs)
Starts the server in
ProcessBuilder with the given config config(String...)
Throws all exceptions as RuntimeException |
args, args, binaryFile, downloadUrl, getConfigFile, getValue, getValue, pid, pidFile, port, toString, urlpublic Nats()
Nats without any start able configurationpublic Nats(int port)
Nats with the simplest start able configurationport - start port, -1 = random, default is 4222public Nats(String... kv)
Nats with the simplest configuration config(String...)kv - passes the original parameters to the server. example: port:4222, user:admin, password:adminpublic Map<NatsConfig,MapValue> config()
Nats configurationpublic Nats config(NatsConfig key, String value)
Nats configurationpublic Nats config(Map<NatsConfig,String> config)
config - passes the original parameters to the server.Natsconfig(String...),
NatsConfigpublic Nats config(String... kv)
kv - example: port, 4222, user, admin, password, adminNatsNatsConfigpublic Nats tryStart()
ProcessBuilder with the given parameterConfig config(String...)
Throws all exceptions as RuntimeExceptionNatspublic Nats tryStart(long timeoutMs)
ProcessBuilder with the given config config(String...)
Throws all exceptions as RuntimeExceptiontimeoutMs - defines the start-up timeout -1 no timeout, else waits until port upNatspublic Nats start() throws Exception
ProcessBuilder with the given config config(String...)NatsIOException - if Nats is not found or unsupported on the SystemUtilBindException - if port is already takenPortUnreachableException - if Nats is not starting cause port is not freeExceptionpublic Nats start(long timeoutMs) throws Exception
ProcessBuilder with the given config config(String...)timeoutMs - defines the start-up timeout -1 no timeout, else waits until port upNatsIOException - if Nats is not found or unsupported on the SystemUtilBindException - if port is already takenPortUnreachableException - if Nats is not starting cause port is not freeExceptionpublic void close()
public Nats stop()
ProcessBuilder and kills the Nats
Only a log error will occur if the Nats were never startedNatspublic Nats stop(long timeoutMs)
ProcessBuilder and kills the Nats
Only a log error will occur if the Nats were never startedtimeoutMs - defines the tear down timeout, -1 no timeout, else waits until port is free againNatsCopyright © 2022. All rights reserved.