[
https://issues.apache.org/jira/browse/CAMEL-25279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen reassigned CAMEL-25279:
-----------------------------------
Fix Version/s: 4.23.0
Assignee: shashank
> camel-knative - a consumer with reply=false answers 204 No Content when the
> route fails, so Knative takes the event as delivered
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-25279
> URL: https://issues.apache.org/jira/browse/CAMEL-25279
> Project: Camel
> Issue Type: Bug
> Components: camel-knative-http
> Reporter: shashank
> Assignee: shashank
> Priority: Minor
> Fix For: 4.23.0
>
>
> {{KnativeHttpConsumer}} computes the status of the response from the exchange
> ({{500}} when it failed, or {{CamelHttpResponseCode}}), then:
> {code:java}
> if (request.response().getStatusCode() != 204 && configuration.isReply()) {
> body = computeResponseBody(exchange.getMessage());
> ...
> }
> if (body != null) {
> request.response().end(body);
> } else {
> request.response().setStatusCode(204);
> request.response().end();
> }
> {code}
> With {{reply=false}} (endpoint option, or the {{Knative.KNATIVE_REPLY}}
> metadata of the resource set to false) there is never a body, so the error
> status is always overwritten with {{204 No Content}}. Knative (broker,
> channel, source) takes a 2xx answer as a delivered event, so an event whose
> route failed is not retried and not sent to the dead letter sink: it is lost.
> CAMEL-24428 fixed the same overwrite for {{muteException}} with
> {{reply=true}} ("a null body makes the caller send 204 No Content, which
> would discard the error status").
> h3. Reproduction
> {{KnativeHttpTest.testNoReplyFailure}} (like {{testNoReply}}, the route
> throws): main answers {{Expected status code <500> but was <204>}} for the
> three CloudEvents versions.
> h3. Proposed fix
> Without a body, set 204 only when the exchange did not fail; a failed
> exchange keeps its error status, with an empty body. With the fix the
> camel-knative-http tests pass (176). The upgrade guide for 4.23 gets a short
> note.
> Affected: 4.14.x, 4.18.x and main (same code).
> Duplicate check (2026-10-02): JIRA text "knative" with "reply"/"204"/"failed"
> (15 issues): only CAMEL-24428 (the muteException case). GitHub pull requests
> "knative reply": none.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)