[
https://issues.apache.org/jira/browse/CAMEL-15751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rajasekhar Bhupasamudram updated CAMEL-15751:
---------------------------------------------
Description:
Current camel-grpc module provides both the consumer and producer abilities.
But, does not allow the camel route to have control over when the responses are
sent back to the client.
{code:java}
<route>
<from
uri="grpc://remotehost:1101/org.apache.camel.component.grpc.PingPong?consumerStrategy=PROPAGATION"/>
<process ref="myCustomProcessor" />
</route>
{code}
Consider the above route as an example for grpc consumer (server streaming
call).
In the above, myCustomProcessor can modify the Exchange and set a Message, but
if it needs to respond to the client multiple times with a time gap - based on
business requirement, using _responseObserver.onNext()_ method calls, then it
can't. There is a possibility to collect all the responses in a list and send
the list items one after the other. But, if the processor needs to wait for
certain amount of time to compute the next response, and then invoke the
onNext, it is not possible.
I think it is a limitation of the camel-grpc component and propose to enhance
it by setting the responseObserver as a property in the Exchange object.
was:
Current camel-grpc module provides both the consumer and producer abilities.
But, does not allow the camel route to have control over when the responses are
sent back to the client.
{code:java}
<route>
<from
uri="grpc://remotehost:1101/org.apache.camel.component.grpc.PingPong?consumerStrategy=PROPAGATION"/>
<process ref="myCustomProcessor" />
</route>
{code}
Consider the as an example for grpc consumer (server streaming end point).
In the above, myCustomProcessor can modify the Exchange and set a Message, but
if it needs to respond to the client multiple times with a time gap, using
_responseObserver.onNext()_ method calls, then it can't. There is a possibility
to collect all the responses in a list and send the list items one after the
other. But, if the processor needs to wait for certain amount of time to
compute the next response, and then invoke the onNext, it is not possible.
I think it is a limitation of the camel-grpc component and propose to enhance
it by setting the responseObserver as a property in the Exchange object.
Another improvement that I see is that, In the
_GrpcRequestPropagationStreamObserver_,
# The _responseStream.onCompleted()_ is called every time an onNext is
invoked. This does not leverage the Http 2.0 abilities to send the responses
back to the client asynchronously.
# Every time, the camel route is traversed, the server is sending some
response to the client using the onNext method calls. But, sometimes, it may be
a good idea to not to send any data immediately.
I propose to allow the camel route to control this behavior with some
properties.
> camel-grpc - Provide access to stream observer in the camel Exchange
> --------------------------------------------------------------------
>
> Key: CAMEL-15751
> URL: https://issues.apache.org/jira/browse/CAMEL-15751
> Project: Camel
> Issue Type: New Feature
> Components: camel-grpc
> Reporter: Rajasekhar Bhupasamudram
> Assignee: Dmitry Volodin
> Priority: Minor
> Fix For: 3.7.0
>
>
> Current camel-grpc module provides both the consumer and producer abilities.
> But, does not allow the camel route to have control over when the responses
> are sent back to the client.
>
> {code:java}
> <route>
> <from
> uri="grpc://remotehost:1101/org.apache.camel.component.grpc.PingPong?consumerStrategy=PROPAGATION"/>
> <process ref="myCustomProcessor" />
> </route>
> {code}
>
> Consider the above route as an example for grpc consumer (server streaming
> call).
> In the above, myCustomProcessor can modify the Exchange and set a Message,
> but if it needs to respond to the client multiple times with a time gap -
> based on business requirement, using _responseObserver.onNext()_ method
> calls, then it can't. There is a possibility to collect all the responses in
> a list and send the list items one after the other. But, if the processor
> needs to wait for certain amount of time to compute the next response, and
> then invoke the onNext, it is not possible.
> I think it is a limitation of the camel-grpc component and propose to enhance
> it by setting the responseObserver as a property in the Exchange object.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)