Claus Ibsen created CAMEL-26158:
-----------------------------------
Summary: camel-vertx - a consumer reply with a body that has no
codec is lost silently and the requester times out, even when the request is
echoed unchanged
Key: CAMEL-26158
URL: https://issues.apache.org/jira/browse/CAMEL-26158
Project: Camel
Issue Type: Bug
Components: camel-vertx
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of disruptor, disruptor-vm and vertx
(CAMEL-24961, PR #28394).
h4. 1. A reply body without a codec is lost silently
{{VertxConsumer}} (main 2a465aa4814c, line 77) calls {{event.reply(body)}}
inside the {{AsyncCallback}}. When the body has no EventBus codec (an
{{InputStream}}, a stream cache, a non-Serializable POJO), Vert.x throws an
{{IllegalArgumentException}} that nobody catches or logs, no reply is sent and
the requester waits for its timeout (30 seconds by default). The worst case is
a route that does not change the body: a {{Buffer}} request becomes a stream
cache with stream caching on, so an echo route never replies. Checked on
4.24.0-SNAPSHOT with an embedded Vert.x 5.2.1.
Proposed: catch the error of {{event.reply}}, log it and send
{{event.fail(...)}}, and convert a stream cache back to a {{Buffer}} (or
{{byte[]}}) before replying.
h4. 2. pubSub=true is ignored for InOut
{{VertxProducer.process}} (line 61) sends a request whenever the exchange is
out-capable, and reads {{pubSub}} only for InOnly (line 66), so {{pubSub=true}}
with InOut sends to one consumer instead of publishing. The option description
({{VertxEndpoint}}, line 119) does not say so. Checked on 4.24.0-SNAPSHOT with
an embedded Vert.x 5.2.1.
Proposed: document that {{pubSub}} applies to InOnly only (or publish and
complete without a reply when {{pubSub=true}}).
h4. 3. A null body fails with a misleading error
With no body, {{VertxProducer.process}} (line 78) fails with
{{InvalidPayloadRuntimeException(exchange, String.class)}}: {{No body available
of type: java.lang.String}}, though the producer sends any body type and does
not need a String. Checked on 4.24.0-SNAPSHOT with an embedded Vert.x 5.2.1.
Proposed: fail with a message that says the EventBus cannot send a null body.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)