Claus Ibsen created CAMEL-27718:
-----------------------------------
Summary: camel-grpc: consumer ignores flowControlWindow,
CamelGrpcEventType label, undocumented header
Key: CAMEL-27718
URL: https://issues.apache.org/jira/browse/CAMEL-27718
Project: Camel
Issue Type: Bug
Components: camel-grpc
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-grpc for CAMEL-23832
(commit
https://github.com/apache/camel/commit/97b93cd4318f3a4584f6c614f5b3de482922d042).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. flowControlWindow has no effect on the consumer
{{GrpcConsumer.initializeServer()}} calls
{{NettyServerBuilder.flowControlWindow(configuration.getFlowControlWindow())}}
and then
{{initialFlowControlWindow(configuration.getInitialFlowControlWindow())}}. In
grpc-netty 1.85.1 both methods write the same {{flowControlWindow}} field of
the builder: the second call wins and turns auto flow control back on. A
consumer with {{flowControlWindow=...}} therefore keeps
{{initialFlowControlWindow}} (default 1 MiB) with auto flow control, and the
user sees no change. The option has no label, so the docs list it for both
sides.
Proposed change: give {{flowControlWindow}} the label {{producer}}, or on the
consumer call {{flowControlWindow}} instead of {{initialFlowControlWindow}}
when the user set it (a fixed window without auto flow control).
h4. 2. Wrong option name in the STREAMING producer error
The constructor of {{GrpcProducer}} throws {{IllegalStateException("The
streamReplyTo property is mandatory when using the STREAMING mode")}}. The
option is {{streamRepliesTo}}.
Proposed change: name {{streamRepliesTo}} in the message.
h4. 3. CamelGrpcEventType header has the label consumer, but producers read and
set it
{{GrpcConstants.GRPC_EVENT_TYPE_HEADER}} has {{label = "consumer"}}. The
producer also uses it: {{GrpcStreamingExchangeForwarder.forward()}} reads it to
send onNext, onError or onCompleted on the shared stream,
{{GrpcProducerToRouteControlledStreamObserver.process()}} requires it, and
{{GrpcResponseRouterStreamObserver}} sets it on the exchanges sent to
{{streamRepliesTo}}. The header is missing from the producer headers in the
docs.
Proposed change: change the label to {{common}}.
h4. 4. Content-Type header of the consumer is not documented
{{GrpcMethodHandler.populateGrpcHeaders()}} sets the {{Content-Type}} header
({{Exchange.CONTENT_TYPE}}) to the content-type of the request, for example
{{application/grpc}}, from {{GrpcHeaderInterceptor.CONTENT_TYPE_CONTEXT_KEY}}.
{{GrpcConstants}} has no {{@Metadata}} entry for it, so the header list of the
docs does not show it.
Proposed change: document the header in {{GrpcConstants}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)