Package io.micronaut.protobuf.json
Class GrpcProxyController
java.lang.Object
io.micronaut.protobuf.json.GrpcProxyController
@Singleton
@Controller("/${micronaut.grpc.proxy.path:`grpc-json`}")
public final class GrpcProxyController
extends Object
Controller handling gRPC method invocations via HTTP requests.
This class acts as a bridge to invoke gRPC methods by forwarding HTTP requests to the corresponding gRPC services, enabling seamless interaction with gRPC endpoints using JSON payloads. It is designed to facilitate gRPC-JSON transcoding through the `GrpcProxyService`.
The `GrpcProxyController` is marked as `@Experimental`, indicating that its API or functionality may undergo changes in future versions. This controller is registered as a singleton and handles requests on the path defined by the configuration property `micronaut.grpc.proxy.path`, defaulting to `grpc-json`.
The controller provides an HTTP POST endpoint to handle gRPC service method invocations and manages various errors, mapping them to appropriate HTTP responses.
This class acts as a bridge to invoke gRPC methods by forwarding HTTP requests to the corresponding gRPC services, enabling seamless interaction with gRPC endpoints using JSON payloads. It is designed to facilitate gRPC-JSON transcoding through the `GrpcProxyService`.
The `GrpcProxyController` is marked as `@Experimental`, indicating that its API or functionality may undergo changes in future versions. This controller is registered as a singleton and handles requests on the path defined by the configuration property `micronaut.grpc.proxy.path`, defaulting to `grpc-json`.
The controller provides an HTTP POST endpoint to handle gRPC service method invocations and manages various errors, mapping them to appropriate HTTP responses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.http.HttpResponse<String>
io.micronaut.http.HttpResponse<String>
handleBadRequest
(io.micronaut.http.exceptions.HttpStatusException e) io.micronaut.http.HttpResponse<String>
io.micronaut.http.HttpResponse<String>
io.micronaut.http.HttpResponse<String>
io.micronaut.http.HttpResponse<String>
invokeMethod
(String serviceName, String methodName, String jsonRequest)
-
Constructor Details
-
GrpcProxyController
-
-
Method Details
-
invokeMethod
-
handleServiceNotFound
@Error(ServiceNotFoundException.class) public io.micronaut.http.HttpResponse<String> handleServiceNotFound(ServiceNotFoundException e) -
handleMethodNotFound
@Error(MethodNotFoundException.class) public io.micronaut.http.HttpResponse<String> handleMethodNotFound(MethodNotFoundException e) -
handleBadRequest
@Error(io.micronaut.http.exceptions.HttpStatusException.class) public io.micronaut.http.HttpResponse<String> handleBadRequest(io.micronaut.http.exceptions.HttpStatusException e) -
handleGrpcError
@Error(GrpcInvocationException.class) public io.micronaut.http.HttpResponse<String> handleGrpcError(GrpcInvocationException e) -
handle
@Error(io.micronaut.http.exceptions.HttpStatusException.class) public io.micronaut.http.HttpResponse<String> handle(ProtobufTranscodingException e)
-