Run the NATS messaging system server.
Useful for running unit or integration tests on the localhost.
The server must be in your path under the name nats-server
or you must set the NATS_SERVER_PATH
environment variable
to point to it
NatsServerRunner(1234).use{
println("Server running on port: " + it.uri)
val c = Nats.connect(it.uri)
...
}
Inspired by java-nats-server-runner, but corrected and simplified
- Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
repositories { mavenCentral() maven(url = "https://jitpack.io") }
- Add the dependency
dependencies { testImplementation("com.github.redbadger:nats-server-runner:1.0.0") }
The project is deployed using JitPack
NatsServerRunner is available under the MIT license. See the LICENSE file for more info.