Hi everyone, right now i'm building a ktor server ...
# ktor
a
Hi everyone, right now i'm building a ktor server to handle some web-request. In addition to that i would like talk to some other services via grpc. For example a flow like this: • Some other service initiates the flow via gRPC • Receive some data via Post-Method in ktor • Tell someone via gRPC that i got some data. I tried to just start a second server from the main-method for the gRPC handling, also after some testing i think it could work, but it feels a little wierd. Is there a proper way to do something like that?
Copy code
fun main() {
    val server = GrpcServer(50051)
    server.start()
    // server.blockUntilShutdown()

    embeddedServer(Netty, port = 8080, host = "0.0.0.0") {
        installPlugins()
        configureModules()
    }.start(wait = true)
}
a
Also, you can launch two concurrent coroutines for both servers in the main function.
👍 1