You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/10/26 07:41:31 UTC

[GitHub] [camel] rajasekharb commented on a change in pull request #4508: CAMEL-15751 Base improvement to provide access to stream observer in the camel Exchange

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:
users@infra.apache.org