1

We have a existing springboot project which has terrible API management system. So we wanna do something like grpc-gateway related work. But we don't want to add sidecar to our existing service. We found that Armeria has a wonderful json grpc transcoding function. How do we leverage this thing to our existing spring boot project.

Hu Guang
  • 61
  • 7

1 Answers1

2

We found that Armeria has a wonderful json grpc transcoding function.

I guess a minimal example may look like the following:

    final GrpcService grpcService = GrpcService.builder()
        .addService(new MyGrpcService())
        .enableHttpJsonTranscoding(true) // enable http json transcoding
        .build();
    final ServerBuilder sb = Server.builder();
    sb.service(grpcService).serviceUnder("/foo", grpcService); // add the grpc service to the server
    final Server server = sb.build();
    Runtime.getRuntime().addShutdownHook(new Thread(() -> {
        server.stop().join();
    }));
    server.start().join(); // start the server

How do we leverage this thing to our existing spring boot project.

Armeria also offers spring-boot integration. An example can be found in the following repository.

You can also ask at slack or github issues if you have any additional/follow up questions.

jrhee17
  • 1,152
  • 9
  • 19