davsclaus opened a new pull request, #28941: URL: https://github.com/apache/camel/pull/28941
Fixes [CAMEL-26158](https://issues.apache.org/jira/browse/CAMEL-26158). ### 1. A reply body without a codec was lost silently **What was wrong:** `VertxConsumer` called `event.reply(body)` in the `AsyncCallback`. When the body has no event bus codec (an `InputStream`, a stream cache, a POJO that is not `Serializable`), Vert.x throws an `IllegalArgumentException` that nobody caught or logged. No reply was sent and the requester waited for its timeout (30 seconds by default). An echo route hit this too: a `Buffer` request becomes a stream cache with stream caching on, so a route that does not change the body never replied. **What changed:** - A stream body (`StreamCache` or `InputStream`) is replied as a `Buffer` with its content. A `Buffer` request echoed by the route comes back as a `Buffer`. - When `event.reply` still fails, the consumer sends a failure reply (`event.fail(500, "Exchange processing failed")`, the same failure as for a failed route, CAMEL-25249) and passes the error to the consumer's exception handler, which logs it at WARN by default. ### 2. pubSub=true is ignored for InOut **What was wrong:** with InOut, the producer sends a request to one consumer and reads `pubSub` only for InOnly. The option description did not say so. **What changed:** the `pubSub` option description and the component doc now say that it only applies to InOnly exchanges. The behaviour is unchanged. Publishing and completing without a reply would change what existing InOut routes get back, so I did not do that. ### 3. A null body failed with a misleading error **What was wrong:** the producer failed a message without a body with `No body available of type: java.lang.String`, though it sends any body type. **What changed:** it still throws an `InvalidPayloadRuntimeException` (so an existing `onException` still matches), now for `java.lang.Object` and with the cause `Cannot send a message without a body to the event bus address: <address>`. Note: Vert.x itself has a null codec, and the consumer replies with a null body. Whether the producer should send a message without a body is a separate question, so the check stays. ### Tests - `VertxRequestReplyStreamTest` (new): echo of a `Buffer` request (the route receives a stream cache) and a route that ends with an `InputStream`; both get a `Buffer` reply. - `VertxRequestReplyFailureTest`: a reply body with no codec gets a `RECIPIENT_FAILURE` 500 reply; a message without a body fails with the new message. - All four new tests failed before the fix (the three reply tests with a `TIMEOUT` after 30 seconds). Module suite: 36 tests, 0 failures, with `-Psourcecheck`. ### Docs and generated files - `vertx-component.adoc`: pubSub only for InOnly, stream replies, failure reply when the body has no codec. - `@BodyTypes` `consumerReply`: adds `stream` and no longer says the requester times out. - Upgrade guide 4.24: new `camel-vertx` entry (the requester now gets a `Buffer` or a failure reply instead of a timeout). - Regenerated `vertx.json` (component and catalog), the catalog doc copy and `VertxEndpointBuilderFactory`. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 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]
