Daniel
05/09/2023, 3:26 PMApplicationEngineEnvironment
with multiple sslConnector
calls on different ports, plus one connector on localhost
with port set to 0 (ie. let it select random available port). I know from here that I can use resolvedConnectors()
function to determine what port was selected, however I also want to use the`start(wait = true)` . Is there a way to call start without waiting, get the selected port value and then wait in the same way as it would with start(wait = true)
?Aleksei Tirman [JB]
05/10/2023, 9:16 AMval engine = embeddedServer(Netty, port = 0) {}
val serverJob = CompletableDeferred<Unit>()
engine.application.environment.monitor.subscribe(ApplicationStopped) {
serverJob.complete(Unit)
}
engine.start(wait = false)
val port = engine.resolvedConnectors().first().port
println(port)
serverJob.await()
Daniel
05/10/2023, 9:19 AMAleksei Tirman [JB]
05/10/2023, 9:19 AM