davsclaus opened a new pull request, #29277:
URL: https://github.com/apache/camel/pull/29277

   _Claude Code on behalf of Claus Ibsen_
   
   ## Summary
   
   [CAMEL-26550](https://issues.apache.org/jira/browse/CAMEL-26550): with 
`routeControlledStreamObserver=true` and the default `PROPAGATION` consumer 
strategy, client streaming and bidirectional streaming calls ignored the option:
   
   - the exchange had no `grpcResponseObserver` / `grpcResponseType` / 
`grpcMuteException` properties, so a `toRouteControlledStreamObserver` producer 
failed with `IllegalArgumentException` ("did not come from a gRPC consumer with 
routeControlledStreamObserver=true")
   - the consumer still sent the body at the end of the route as the reply and 
ended the call itself, so the route and the consumer both replied
   
   Unary and server streaming calls (`GrpcMethodHandler.handle()`) and the 
`DELEGATION` observer already honoured the option; only the `PROPAGATION` 
observer did not.
   
   ## Fix
   
   The JIRA suggested rejecting the combination at consumer start, but the 
documented server-streaming example uses `routeControlledStreamObserver=true` 
with the default `PROPAGATION`, as do `RouteControlledStreamObserverTest` and 
`GrpcProxySyncAsyncTest`. This PR supports the combination instead:
   
   - `GrpcRequestPropagationStreamObserver` sets the route-controlled exchange 
properties (reusing `GrpcMethodHandler.setRouteControlledProperties`, with one 
`AtomicBoolean` failed flag shared by the events of the call) and sends no 
replies and does not end the call itself. The route does that, as with 
`DELEGATION`.
   - The events of a call are still routed one at a time, in order (the latch 
wait), which is what distinguishes `PROPAGATION` from `DELEGATION`.
   - After the route ended the call with an error, later `onNext` events are 
skipped, as they already were when a failed exchange ended the call.
   - As with `DELEGATION`, an exchange that fails without the route replying 
leaves the call to the client's deadline. The consumer does not reply in 
route-controlled mode.
   
   Without route control, `PROPAGATION` behaves as before.
   
   ## Docs
   
   - `grpc-component.adoc`: the client/bidi streaming section no longer says 
`PROPAGATION` gives "more responses than you expected"; it explains the 
difference between the two strategies. The `CamelGrpcEventType` paragraph no 
longer says the header is set only for `DELEGATION` events.
   - `consumerStrategy` option description: covers `PROPAGATION` with 
`routeControlledStreamObserver=true` (catalog JSON and endpoint DSL 
regenerated).
   - Upgrade guide 4.24: a route-controlled `PROPAGATION` consumer no longer 
sends the route body as the reply of streaming calls.
   
   ## Tests
   
   New `GrpcPropagationRouteControlledTest`:
   - bidi call with two requests: exactly one reply per request, in order, then 
completed by the forwarded `onCompleted`; no exchange fails
   - client streaming call with two requests: the single reply sent by the 
route on the forwarded `onCompleted`; the unchanged requests are not sent as 
replies
   
   Both tests fail on `main` with the two errors from the JIRA (missing 
`grpcResponseObserver`, and the request sent as the reply). All 78 camel-grpc 
tests pass.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to