question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I add JSON-based GRPC services, a.k.a unframed gRPC-JSON?

See original GitHub issue

I wonder if it is possible to auto add Json based service whenever a GRPC service is added to server. This will helps organizations who want to migrate from Json base Rest apis server to Armeria-Grpc server.

For example, we have a grpc SomeGrpcService which have a rpc SayHello. And the path for SayHello GRPC service could be something like my.package/SomeGrpcService/SayHello.

With the following config, we could auto add a Rest version SayHello service while binding to the path of my.package/SomeGrpcService/Rest/SayHello.

 serverBuilder
            .service(
                (ServiceWithPathMappings<HttpRequest, HttpResponse>)
                    new GrpcServiceBuilder()
                        // This is the config of new proposed function
                        .enableRestService(true)
                        .addService(someGrpcService)
                        .supportedSerializationFormats(GrpcSerializationFormats.values())
                        .build()
           )

Then, by default, we assume the GRPC request and response of SayHello service is SayHelloRequest and SayHelloResponse. And to serve all client Json based Rest requests to the path of my.package/SomeGrpcService/Rest/SayHello via GRPC SayHello service by adding a layer which using @chokoswitch 's Buffer <-> JSON marshaller to convert to/from Json and GRPC request and response.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
anuraagacommented, Jan 11, 2018

Yeah - the format is determined by the content type of the request. In fact, this is currently being the debug form for gRPC.

There is a bit of documentation here, if there’s anything not clear let me know so we can fix it 😃

http://line.github.io/armeria/server-grpc.html#unframed-requests

0reactions
trustincommented, Jan 25, 2018

Updated the title of this issue to make it an answered question.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gRPC + JSON
From the point of view of gRPC, a Service is a collection of Methods. In Java, a method is represented as a MethodDescriptor....
Read more >
gRPC JSON transcoding in ASP.NET Core gRPC apps
This document discusses how to create JSON Web APIs using gRPC services. Overview. gRPC JSON transcoding is an extension for ASP.NET Core that ......
Read more >
gRPC - Grafana k6
gRPC is a lightweight open-source RPC framework. Starting with k6 v0.29.0, we support unary gRPC requests.
Read more >
How to expose a gRPC service both as Protobuf and JSON
gRPC supports streaming, which cannot be implemented in HTTP/1. It is not possible to make a gRPC service available as classic HTTP+REST.
Read more >
How to use gRPC and protobuf with JavaScript and ReactJS?
What are gRPC and protocol buffers (aka protobuf)? ... Most common usage scenarios include connecting services in microservices style ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found