Skip to content

Easily implement a grpc server with the wire library

License

Notifications You must be signed in to change notification settings

hadrienk/wire-grpc

Repository files navigation

Wire GRPC

Create grpc BindableService using your wire generated interfaces. Simply wrap your service implementation in a ReflectionBindableService class.

class ServiceImpl : SomeServiceServer {
  override suspend fun Unary(request: Input): Output {
    // [...]
  }

  override suspend fun ServerStream(request: Input, response: SendChannel<Output>) {
    // [...]
  }

  override suspend fun ClientStream(request: ReceiveChannel<Input>): Output {
    // [...]
  }

  override suspend fun BiDiStream(request: ReceiveChannel<Input>, response: SendChannel<Output>) {
    // [...]
  }

}

fun main() {
    val bindableService = ReflectionBindableService(ServiceImpl())
    server = ServerBuilder.forPort(8080)
        .addService(bindableService)
        .build()
        .start()
}

About

Easily implement a grpc server with the wire library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages