rajasekharb commented on a change in pull request #4508:
URL: https://github.com/apache/camel/pull/4508#discussion_r511764655
##########
File path:
components/camel-grpc/src/main/java/org/apache/camel/component/grpc/server/GrpcMethodHandler.java
##########
@@ -39,19 +39,30 @@ public GrpcMethodHandler(GrpcConsumer consumer) {
this.consumer = consumer;
}
+ /**
+ * This method deals with the unary and server streaming gRPC calls
+ *
+ * @param body The request object sent by the gRPC client to
the server
+ * @param responseObserver The response stream observer
+ * @param methodName The name of the method invoked using the stub.
+ * @throws Exception java.lang.Exception
+ */
public void handle(Object body, StreamObserver<Object> responseObserver,
String methodName) throws Exception {
Map<String, Object> grcpHeaders = populateGrpcHeaders(methodName);
GrpcEndpoint endpoint = (GrpcEndpoint) consumer.getEndpoint();
+
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody(body);
exchange.getIn().setHeaders(grcpHeaders);
- if (endpoint.isSynchronous()) {
- consumer.getProcessor().process(exchange);
- } else {
- consumer.getAsyncProcessor().process(exchange);
+ if (endpoint.getConfiguration().isRouteControlledStreamObserver()) {
+ exchange.setProperty("responseObserver", responseObserver);
Review comment:
I agree. Have set, a constant in GrpcConstants.java.
String GRPC_STREAM_OBSERVER = "grpcResponseObserver";
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]