shashank created CAMEL-27213:
--------------------------------
Summary: camel-seda - a request-reply message that the producer
discards (discardIfNoConsumers, discardWhenFull) waits for the timeout, or for
ever with timeout=0
Key: CAMEL-27213
URL: https://issues.apache.org/jira/browse/CAMEL-27213
Project: Camel
Issue Type: Bug
Components: camel-seda
Reporter: shashank
Assignee: shashank
h3. What happens
When the SEDA producer waits for the reply (an {{InOut}} exchange, such as an
HTTP request routed to seda, or {{waitForTaskToComplete=Always}}), it adds a
copy of the exchange with an on completion that releases the producer, and
waits. When the copy is discarded ({{discardIfNoConsumers=true}} and no
consumer, or {{discardWhenFull=true}} and the queue is full), nothing runs that
on completion: the producer waits for a reply that never comes, until the
{{timeout}} (30 seconds by default), then fails with
{{ExchangeTimedOutException}}, or for ever when {{timeout}} is 0 or less. An
{{InOnly}} exchange that is discarded continues at once (CAMEL-25123).
With {{discardWhenFull}} used for load shedding in front of a request-reply
route, each shed request holds its calling thread (such as an HTTP worker
thread) for the whole timeout instead of being shed.
h3. How to reproduce
{{SedaInOutDiscardTest}} (camel-core): a request to
{{seda:none?discardIfNoConsumers=true&timeout=20000}} without a consumer, and a
request to a full queue with {{discardWhenFull=true}}, do not get an answer
within 5 seconds.
h3. Fix
When the producer discards the copy it waits for, it sets a
{{RejectedExecutionException}} on the copy ("Exchange discarded as the SEDA
queue has no consumers" / "... is full") and runs its on completions, as
{{SedaEndpoint.purgeQueue}} does for the exchanges it discards (CAMEL-24950).
The caller now fails at once with that exception instead of waiting for the
timeout. A discarded {{InOnly}} message is still dropped without an error.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)