Package berlin.yuna.natsserver.logic
Class NatsStreaming
java.lang.Object
berlin.yuna.natsserver.logic.NatsBase
berlin.yuna.natsserver.logic.NatsStreaming
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields inherited from class berlin.yuna.natsserver.logic.NatsBase
NATS_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionCreateNatsStreamingwithout any start able configurationNatsStreaming(int port) CreateNatsStreamingwith the simplest start able configurationNatsStreaming(String... kv) Create customNatsStreamingwith the simplest configurationconfig(String...)NatsStreaming(List<String> customArgs) CreateNatsStreamingwith custom args -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()config()GetNatServerConfigconfig(NatsStreamingConfig key, String value) Configures the nats serverConfigures the nats serverconfig(Map<NatsStreamingConfig, String> config) Configures the nats serverstart()Starts the server inProcessBuilderwith the given configconfig(String...)start(long timeoutMs) Starts the server inProcessBuilderwith the given configconfig(String...)stop()Stops theProcessBuilderand kills theNatsStreamingOnly a log error will occur if theNatsStreamingwere never startedstop(long timeoutMs) Stops theProcessBuilderand kills theNatsStreamingOnly a log error will occur if theNatsStreamingwere never startedtryStart()Starts the server inProcessBuilderwith the given parameterConfigconfig(String...)Throws all exceptions asRuntimeExceptiontryStart(long timeoutMs) Starts the server inProcessBuilderwith the given configconfig(String...)Throws all exceptions asRuntimeException
-
Constructor Details
-
NatsStreaming
public NatsStreaming()CreateNatsStreamingwithout any start able configuration -
NatsStreaming
CreateNatsStreamingwith custom args -
NatsStreaming
public NatsStreaming(int port) CreateNatsStreamingwith the simplest start able configuration- Parameters:
port- start port, -1 = random, default is 4222
-
NatsStreaming
Create customNatsStreamingwith the simplest configurationconfig(String...)- Parameters:
kv- passes the original parameters to the server. example: port:4222, user:admin, password:admin
-
-
Method Details
-
config
GetNatServerConfig- Returns:
- the
NatsStreamingconfiguration
-
config
Configures the nats server- Returns:
- the
NatsStreamingconfiguration
-
config
Configures the nats server- Parameters:
config- passes the original parameters to the server.- Returns:
NatsStreaming- See Also:
-
config
Configures the nats server- Parameters:
kv- example: port, 4222, user, admin, password, admin- Returns:
NatsStreaming- See Also:
-
tryStart
Starts the server inProcessBuilderwith the given parameterConfigconfig(String...)Throws all exceptions asRuntimeException- Returns:
NatsStreaming
-
tryStart
Starts the server inProcessBuilderwith the given configconfig(String...)Throws all exceptions asRuntimeException- Parameters:
timeoutMs- defines the start-up timeout-1no timeout, else waits until port up- Returns:
NatsStreaming
-
start
Starts the server inProcessBuilderwith the given configconfig(String...)- Returns:
NatsStreaming- Throws:
IOException- ifNatsStreamingis not found or unsupported on theSystemUtilBindException- if port is already takenPortUnreachableException- ifNatsStreamingis not starting cause port is not freeException
-
start
Starts the server inProcessBuilderwith the given configconfig(String...)- Parameters:
timeoutMs- defines the start-up timeout-1no timeout, else waits until port up- Returns:
NatsStreaming- Throws:
IOException- ifNatsStreamingis not found or unsupported on theSystemUtilBindException- if port is already takenPortUnreachableException- ifNatsStreamingis not starting cause port is not freeException
-
close
public void close() -
stop
Stops theProcessBuilderand kills theNatsStreamingOnly a log error will occur if theNatsStreamingwere never started- Returns:
NatsStreaming
-
stop
Stops theProcessBuilderand kills theNatsStreamingOnly a log error will occur if theNatsStreamingwere never started- Parameters:
timeoutMs- defines the tear down timeout,-1no timeout, else waits until port is free again- Returns:
NatsStreaming
-