Package berlin.yuna.natsserver.logic
Class NatsBase
- java.lang.Object
-
- berlin.yuna.natsserver.logic.NatsBase
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
NatsStreaming
public abstract class NatsBase extends Object implements AutoCloseable
- Since:
- 1.0
- Author:
- Yuna Morgenstern
- See Also:
SystemUtil
,NatsBase
-
-
Field Summary
Fields Modifier and Type Field Description static String
NATS_PREFIX
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
args()
Get customArgumentsNatsBase
args(String... args)
Adds custom arguments to the nats start commandPath
binaryFile()
nats binary file which only exists after download or if its already placed thereString
downloadUrl()
nats download url which is usually a zip fileString
getValue(NatsStreamingConfig key)
Gets resolved config value from keyString
getValue(NatsStreamingConfig key, Supplier<String> or)
Gets resolved config value from keyint
pid()
get process idPath
pidFile()
get process id file which only exists when the process is runningint
port()
Gets the port out of the configurationString
toString()
String
url()
nats server URL from bind to host address-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Field Detail
-
NATS_PREFIX
public static final String NATS_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
pid
public int pid()
get process id- Returns:
- process id or -1 if process is not running
-
pidFile
public Path pidFile()
get process id file which only exists when the process is running- Returns:
- process id file path
-
binaryFile
public Path binaryFile()
nats binary file which only exists after download or if its already placed there- Returns:
- nats binary file path
-
downloadUrl
public String downloadUrl()
nats download url which is usually a zip file- Returns:
- nats download url
-
url
public String url()
nats server URL from bind to host address- Returns:
- nats server url
-
port
public int port()
Gets the port out of the configuration- Returns:
- configured port of the server
- Throws:
RuntimeException
- when the port is not configured
-
args
public NatsBase args(String... args)
Adds custom arguments to the nats start command- Parameters:
args
- arguments- Returns:
- self
NatsBase
-
getValue
public String getValue(NatsStreamingConfig key)
Gets resolved config value from key- Parameters:
key
- config key- Returns:
- config key value
-
getValue
public String getValue(NatsStreamingConfig key, Supplier<String> or)
Gets resolved config value from key- Parameters:
key
- config keyor
- lazy loaded fallback value- Returns:
- config key value
-
-