You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2026/08/27 09:20:13 UTC
(camel) branch main updated: CAMEL-24428: camel-knative - add a muteException consumer option (#25685)
This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 22cccdecdebd CAMEL-24428: camel-knative - add a muteException consumer option (#25685)
22cccdecdebd is described below
commit 22cccdecdebd948bea1bcdd6a184345d013a3b1a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Aug 27 11:20:05 2026 +0200
CAMEL-24428: camel-knative - add a muteException consumer option (#25685)
The Knative HTTP consumer returned ExceptionHelper.stackTraceToString() as the
response body of a failed exchange, so a route failure handed the caller the
stack trace. The http consumers gained a muteException option defaulting to
true in CAMEL-23651; camel-knative had no equivalent.
The muted body is empty rather than null: a null body makes the caller send
204 No Content, which would have discarded the 500 the failure produced.
KnativeTransportConfiguration keeps its three-argument constructor, delegating
with muteException = true.
Co-authored-by: Claude Opus 5 (1M context) <no...@anthropic.com>
---
.../apache/camel/catalog/components/knative.json | 38 +++++++-------
.../knative/spi/KnativeTransportConfiguration.java | 21 ++++++++
.../knative/KnativeComponentConfigurer.java | 6 +++
.../knative/KnativeEndpointConfigurer.java | 6 +++
.../knative/KnativeEndpointUriFactory.java | 3 +-
.../apache/camel/component/knative/knative.json | 38 +++++++-------
.../component/knative/KnativeConfiguration.java | 14 +++++
.../camel/component/knative/KnativeEndpoint.java | 3 +-
.../knative/http/KnativeHttpConsumer.java | 17 +++---
.../component/knative/http/KnativeHttpTest.java | 60 ++++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_23.adoc | 23 +++++++++
.../dsl/KnativeComponentBuilderFactory.java | 19 +++++++
.../dsl/KnativeEndpointBuilderFactory.java | 32 ++++++++++++
13 files changed, 236 insertions(+), 44 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/knative.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/knative.json
index d40f654d5178..e9d93d28649f 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/knative.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/knative.json
@@ -38,15 +38,16 @@
"transportOptions": { "index": 10, "kind": "property", "displayName": "Transport Options", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "transport.", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the transport options." },
"typeId": { "index": 11, "kind": "property", "displayName": "Type Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the service to lookup from the KnativeEnvironment." },
"bridgeErrorHandler": { "index": 12, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the lik [...]
- "replyWithCloudEvent": { "index": 13, "kind": "property", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by the [...]
- "reply": { "index": 14, "kind": "property", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
- "lazyStartProducer": { "index": 15, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fai [...]
- "apiVersion": { "index": 16, "kind": "property", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
- "autowiredEnabled": { "index": 17, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching [...]
- "kind": { "index": 18, "kind": "property", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." },
- "name": { "index": 19, "kind": "property", "displayName": "Name", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the k8s resource referenced by the endpoint." },
- "healthCheckConsumerEnabled": { "index": 20, "kind": "property", "displayName": "Health Check Consumer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all consumer based health checks from this component" },
- "healthCheckProducerEnabled": { "index": 21, "kind": "property", "displayName": "Health Check Producer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on produce [...]
+ "muteException": { "index": 13, "kind": "property", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If enabled and an Exchange failed processing on the consumer side the response's bod [...]
+ "replyWithCloudEvent": { "index": 14, "kind": "property", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by the [...]
+ "reply": { "index": 15, "kind": "property", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
+ "lazyStartProducer": { "index": 16, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fai [...]
+ "apiVersion": { "index": 17, "kind": "property", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
+ "autowiredEnabled": { "index": 18, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching [...]
+ "kind": { "index": 19, "kind": "property", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." },
+ "name": { "index": 20, "kind": "property", "displayName": "Name", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the k8s resource referenced by the endpoint." },
+ "healthCheckConsumerEnabled": { "index": 21, "kind": "property", "displayName": "Health Check Consumer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all consumer based health checks from this component" },
+ "healthCheckProducerEnabled": { "index": 22, "kind": "property", "displayName": "Health Check Producer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on produce [...]
},
"properties": {
"type": { "index": 0, "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.knative.spi.Knative.Type", "enum": [ "endpoint", "channel", "event" ], "deprecated": false, "autowired": false, "secret": false, "description": "The Knative resource type" },
@@ -58,14 +59,15 @@
"filters": { "index": 6, "kind": "parameter", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "prefix": "filter.", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the filters." },
"sinkBinding": { "index": 7, "kind": "parameter", "displayName": "Sink Binding", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeSinkBinding", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The SinkBinding configuration." },
"transportOptions": { "index": 8, "kind": "parameter", "displayName": "Transport Options", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "transport.", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the transport options." },
- "replyWithCloudEvent": { "index": 9, "kind": "parameter", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by the [...]
- "bridgeErrorHandler": { "index": 10, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...]
- "exceptionHandler": { "index": 11, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...]
- "exchangePattern": { "index": 12, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
- "reply": { "index": 13, "kind": "parameter", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
- "lazyStartProducer": { "index": 14, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produ [...]
- "apiVersion": { "index": 15, "kind": "parameter", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
- "kind": { "index": 16, "kind": "parameter", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." },
- "name": { "index": 17, "kind": "parameter", "displayName": "Name", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the k8s resource referenced by the endpoint." }
+ "muteException": { "index": 9, "kind": "parameter", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If enabled and an Exchange failed processing on the consumer side the response's bod [...]
+ "replyWithCloudEvent": { "index": 10, "kind": "parameter", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by th [...]
+ "bridgeErrorHandler": { "index": 11, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...]
+ "exceptionHandler": { "index": 12, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...]
+ "exchangePattern": { "index": 13, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
+ "reply": { "index": 14, "kind": "parameter", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
+ "lazyStartProducer": { "index": 15, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produ [...]
+ "apiVersion": { "index": 16, "kind": "parameter", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
+ "kind": { "index": 17, "kind": "parameter", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." },
+ "name": { "index": 18, "kind": "parameter", "displayName": "Name", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the k8s resource referenced by the endpoint." }
}
}
diff --git a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeTransportConfiguration.java b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeTransportConfiguration.java
index 58b2257786e3..c04f70fbdbdd 100644
--- a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeTransportConfiguration.java
+++ b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeTransportConfiguration.java
@@ -23,11 +23,22 @@ public final class KnativeTransportConfiguration {
private final CloudEvent cloudEvent;
private final boolean removeCloudEventHeadersInReply;
private final boolean reply;
+ private final boolean muteException;
+ /**
+ * Retained for backwards compatibility. Mutes the exception, matching the default of the {@code muteException}
+ * option and of the http consumers aligned by CAMEL-23651.
+ */
public KnativeTransportConfiguration(CloudEvent cloudEvent, boolean removeCloudEventHeadersInReply, boolean reply) {
+ this(cloudEvent, removeCloudEventHeadersInReply, reply, true);
+ }
+
+ public KnativeTransportConfiguration(CloudEvent cloudEvent, boolean removeCloudEventHeadersInReply, boolean reply,
+ boolean muteException) {
this.cloudEvent = cloudEvent;
this.removeCloudEventHeadersInReply = removeCloudEventHeadersInReply;
this.reply = reply;
+ this.muteException = muteException;
}
public CloudEvent getCloudEvent() {
@@ -41,4 +52,14 @@ public final class KnativeTransportConfiguration {
public boolean isReply() {
return reply;
}
+
+ /**
+ * Whether the stack trace of an exception that failed the exchange is kept out of the response returned to the
+ * caller.
+ *
+ * @since 4.23
+ */
+ public boolean isMuteException() {
+ return muteException;
+ }
}
diff --git a/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeComponentConfigurer.java b/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeComponentConfigurer.java
index 27efc80e8af6..0d1264fff2cc 100644
--- a/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeComponentConfigurer.java
+++ b/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeComponentConfigurer.java
@@ -56,6 +56,8 @@ public class KnativeComponentConfigurer extends PropertyConfigurerSupport implem
case "kind": getOrCreateConfiguration(target).setKind(property(camelContext, java.lang.String.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
+ case "muteexception":
+ case "muteException": getOrCreateConfiguration(target).setMuteException(property(camelContext, boolean.class, value)); return true;
case "name": getOrCreateConfiguration(target).setName(property(camelContext, java.lang.String.class, value)); return true;
case "producerfactory":
case "producerFactory": target.setProducerFactory(property(camelContext, org.apache.camel.component.knative.spi.KnativeProducerFactory.class, value)); return true;
@@ -101,6 +103,8 @@ public class KnativeComponentConfigurer extends PropertyConfigurerSupport implem
case "kind": return java.lang.String.class;
case "lazystartproducer":
case "lazyStartProducer": return boolean.class;
+ case "muteexception":
+ case "muteException": return boolean.class;
case "name": return java.lang.String.class;
case "producerfactory":
case "producerFactory": return org.apache.camel.component.knative.spi.KnativeProducerFactory.class;
@@ -147,6 +151,8 @@ public class KnativeComponentConfigurer extends PropertyConfigurerSupport implem
case "kind": return getOrCreateConfiguration(target).getKind();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
+ case "muteexception":
+ case "muteException": return getOrCreateConfiguration(target).isMuteException();
case "name": return getOrCreateConfiguration(target).getName();
case "producerfactory":
case "producerFactory": return target.getProducerFactory();
diff --git a/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeEndpointConfigurer.java b/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeEndpointConfigurer.java
index 7148a050a941..be06c4f68e80 100644
--- a/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeEndpointConfigurer.java
+++ b/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeEndpointConfigurer.java
@@ -42,6 +42,8 @@ public class KnativeEndpointConfigurer extends PropertyConfigurerSupport impleme
case "kind": target.getConfiguration().setKind(property(camelContext, java.lang.String.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
+ case "muteexception":
+ case "muteException": target.getConfiguration().setMuteException(property(camelContext, boolean.class, value)); return true;
case "name": target.getConfiguration().setName(property(camelContext, java.lang.String.class, value)); return true;
case "reply": target.getConfiguration().setReply(property(camelContext, java.lang.Boolean.class, value)); return true;
case "replywithcloudevent":
@@ -76,6 +78,8 @@ public class KnativeEndpointConfigurer extends PropertyConfigurerSupport impleme
case "kind": return java.lang.String.class;
case "lazystartproducer":
case "lazyStartProducer": return boolean.class;
+ case "muteexception":
+ case "muteException": return boolean.class;
case "name": return java.lang.String.class;
case "reply": return java.lang.Boolean.class;
case "replywithcloudevent":
@@ -111,6 +115,8 @@ public class KnativeEndpointConfigurer extends PropertyConfigurerSupport impleme
case "kind": return target.getConfiguration().getKind();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
+ case "muteexception":
+ case "muteException": return target.getConfiguration().isMuteException();
case "name": return target.getConfiguration().getName();
case "reply": return target.getConfiguration().getReply();
case "replywithcloudevent":
diff --git a/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeEndpointUriFactory.java b/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeEndpointUriFactory.java
index 6f0da837dfea..14ab3a17e014 100644
--- a/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeEndpointUriFactory.java
+++ b/components/camel-knative/camel-knative-component/src/generated/java/org/apache/camel/component/knative/KnativeEndpointUriFactory.java
@@ -24,7 +24,7 @@ public class KnativeEndpointUriFactory extends org.apache.camel.support.componen
private static final Set<String> ENDPOINT_IDENTITY_PROPERTY_NAMES;
private static final Map<String, String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(18);
+ Set<String> props = new HashSet<>(19);
props.add("apiVersion");
props.add("bridgeErrorHandler");
props.add("ceOverride");
@@ -36,6 +36,7 @@ public class KnativeEndpointUriFactory extends org.apache.camel.support.componen
props.add("filters");
props.add("kind");
props.add("lazyStartProducer");
+ props.add("muteException");
props.add("name");
props.add("reply");
props.add("replyWithCloudEvent");
diff --git a/components/camel-knative/camel-knative-component/src/generated/resources/META-INF/org/apache/camel/component/knative/knative.json b/components/camel-knative/camel-knative-component/src/generated/resources/META-INF/org/apache/camel/component/knative/knative.json
index d40f654d5178..e9d93d28649f 100644
--- a/components/camel-knative/camel-knative-component/src/generated/resources/META-INF/org/apache/camel/component/knative/knative.json
+++ b/components/camel-knative/camel-knative-component/src/generated/resources/META-INF/org/apache/camel/component/knative/knative.json
@@ -38,15 +38,16 @@
"transportOptions": { "index": 10, "kind": "property", "displayName": "Transport Options", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "transport.", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the transport options." },
"typeId": { "index": 11, "kind": "property", "displayName": "Type Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the service to lookup from the KnativeEnvironment." },
"bridgeErrorHandler": { "index": 12, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the lik [...]
- "replyWithCloudEvent": { "index": 13, "kind": "property", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by the [...]
- "reply": { "index": 14, "kind": "property", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
- "lazyStartProducer": { "index": 15, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fai [...]
- "apiVersion": { "index": 16, "kind": "property", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
- "autowiredEnabled": { "index": 17, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching [...]
- "kind": { "index": 18, "kind": "property", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." },
- "name": { "index": 19, "kind": "property", "displayName": "Name", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the k8s resource referenced by the endpoint." },
- "healthCheckConsumerEnabled": { "index": 20, "kind": "property", "displayName": "Health Check Consumer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all consumer based health checks from this component" },
- "healthCheckProducerEnabled": { "index": 21, "kind": "property", "displayName": "Health Check Producer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on produce [...]
+ "muteException": { "index": 13, "kind": "property", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If enabled and an Exchange failed processing on the consumer side the response's bod [...]
+ "replyWithCloudEvent": { "index": 14, "kind": "property", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by the [...]
+ "reply": { "index": 15, "kind": "property", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
+ "lazyStartProducer": { "index": 16, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fai [...]
+ "apiVersion": { "index": 17, "kind": "property", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
+ "autowiredEnabled": { "index": 18, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching [...]
+ "kind": { "index": 19, "kind": "property", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." },
+ "name": { "index": 20, "kind": "property", "displayName": "Name", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the k8s resource referenced by the endpoint." },
+ "healthCheckConsumerEnabled": { "index": 21, "kind": "property", "displayName": "Health Check Consumer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all consumer based health checks from this component" },
+ "healthCheckProducerEnabled": { "index": 22, "kind": "property", "displayName": "Health Check Producer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on produce [...]
},
"properties": {
"type": { "index": 0, "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.knative.spi.Knative.Type", "enum": [ "endpoint", "channel", "event" ], "deprecated": false, "autowired": false, "secret": false, "description": "The Knative resource type" },
@@ -58,14 +59,15 @@
"filters": { "index": 6, "kind": "parameter", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "prefix": "filter.", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the filters." },
"sinkBinding": { "index": 7, "kind": "parameter", "displayName": "Sink Binding", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeSinkBinding", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The SinkBinding configuration." },
"transportOptions": { "index": 8, "kind": "parameter", "displayName": "Transport Options", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "transport.", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the transport options." },
- "replyWithCloudEvent": { "index": 9, "kind": "parameter", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by the [...]
- "bridgeErrorHandler": { "index": 10, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...]
- "exceptionHandler": { "index": 11, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...]
- "exchangePattern": { "index": 12, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
- "reply": { "index": 13, "kind": "parameter", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
- "lazyStartProducer": { "index": 14, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produ [...]
- "apiVersion": { "index": 15, "kind": "parameter", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
- "kind": { "index": 16, "kind": "parameter", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." },
- "name": { "index": 17, "kind": "parameter", "displayName": "Name", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the k8s resource referenced by the endpoint." }
+ "muteException": { "index": 9, "kind": "parameter", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If enabled and an Exchange failed processing on the consumer side the response's bod [...]
+ "replyWithCloudEvent": { "index": 10, "kind": "parameter", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by th [...]
+ "bridgeErrorHandler": { "index": 11, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...]
+ "exceptionHandler": { "index": 12, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...]
+ "exchangePattern": { "index": 13, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
+ "reply": { "index": 14, "kind": "parameter", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
+ "lazyStartProducer": { "index": 15, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produ [...]
+ "apiVersion": { "index": 16, "kind": "parameter", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
+ "kind": { "index": 17, "kind": "parameter", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." },
+ "name": { "index": 18, "kind": "parameter", "displayName": "Name", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the k8s resource referenced by the endpoint." }
}
}
diff --git a/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java b/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
index 5558b9871107..db1d6adb1f3c 100644
--- a/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
+++ b/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
@@ -54,6 +54,8 @@ public class KnativeConfiguration implements Cloneable {
private boolean replyWithCloudEvent;
@UriParam(label = "consumer,advanced", defaultValue = "true")
private Boolean reply;
+ @UriParam(label = "consumer", defaultValue = "true")
+ private boolean muteException = true;
// ************************
//
@@ -221,6 +223,18 @@ public class KnativeConfiguration implements Cloneable {
this.reply = reply;
}
+ public boolean isMuteException() {
+ return muteException;
+ }
+
+ /**
+ * If enabled and an Exchange failed processing on the consumer side the response's body won't contain the
+ * exception's stack trace.
+ */
+ public void setMuteException(boolean muteException) {
+ this.muteException = muteException;
+ }
+
// ************************
//
// Cloneable
diff --git a/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java b/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
index 00c7511eb52f..c8a51df1e6f3 100644
--- a/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
+++ b/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
@@ -247,7 +247,8 @@ public class KnativeEndpoint extends DefaultEndpoint {
return new KnativeTransportConfiguration(
this.cloudEventProcessor.cloudEvent(),
!this.configuration.isReplyWithCloudEvent(),
- ObjectHelper.supplyIfEmpty(this.configuration.getReply(), definition::getReply));
+ ObjectHelper.supplyIfEmpty(this.configuration.getReply(), definition::getReply),
+ this.configuration.isMuteException());
}
private Stream<KnativeResource> servicesDefinitions() {
diff --git a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java
index 8d23a83d7b48..2688d5ebd18c 100644
--- a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java
+++ b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java
@@ -353,12 +353,17 @@ public class KnativeHttpConsumer extends DefaultConsumer {
Exception exception = message.getExchange().getException();
if (exception != null) {
- // we failed due an exception so print it as plain text
-
- final String stackTrace = ExceptionHelper.stackTraceToString(exception);
-
- // the body should then be the stacktrace
- body = stackTrace.getBytes(StandardCharsets.UTF_8);
+ if (configuration.isMuteException()) {
+ // do not include the stacktrace in the body. Empty rather than null: a null body makes the
+ // caller send 204 No Content, which would discard the error status that was just computed
+ body = new byte[0];
+ } else {
+ // we failed due an exception so print it as plain text
+ final String stackTrace = ExceptionHelper.stackTraceToString(exception);
+
+ // the body should then be the stacktrace
+ body = stackTrace.getBytes(StandardCharsets.UTF_8);
+ }
// force content type to be text/plain as that is what the stacktrace is
message.setHeader(Exchange.CONTENT_TYPE, "text/plain");
diff --git a/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java b/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
index 9705f0b3ef97..98edbf1e7d29 100644
--- a/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
+++ b/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
@@ -71,6 +71,8 @@ import static org.hamcrest.Matchers.is;
public class KnativeHttpTest {
+ private static final String FAILING_CONSUMER_DETAIL = "the-internal-detail-a-caller-must-not-see";
+
private CamelContext context;
private ProducerTemplate template;
@RegisterExtension
@@ -986,6 +988,64 @@ public class KnativeHttpTest {
assertThat(exchange.getException()).hasMessageContaining("with statusCode: 500, statusMessage: Internal Server Error");
}
+ /**
+ * The consumer used to return {@code ExceptionHelper.stackTraceToString(exception)} as the response body, so a
+ * route failure handed the caller the stack trace. {@code muteException} defaults to true, matching the http
+ * consumers aligned by CAMEL-23651. The status must still be the 500 the failure produced, not a 204.
+ */
+ @ParameterizedTest
+ @EnumSource(CloudEvents.class)
+ void aFailedExchangeDoesNotReturnTheStackTraceByDefault(CloudEvent ce) throws Exception {
+ Exchange exchange = invokeFailingConsumer(ce, "knative:endpoint/from");
+
+ assertThat(exchange.isFailed()).isTrue();
+ assertThat(exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE)).isEqualTo(500);
+ assertThat(exchange.getMessage().getBody(String.class))
+ .as("the response body must not carry the route's exception")
+ .isNullOrEmpty();
+ }
+
+ @ParameterizedTest
+ @EnumSource(CloudEvents.class)
+ void muteExceptionFalseRestoresTheStackTraceInTheResponse(CloudEvent ce) throws Exception {
+ Exchange exchange = invokeFailingConsumer(ce, "knative:endpoint/from?muteException=false");
+
+ assertThat(exchange.isFailed()).isTrue();
+ assertThat(exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE)).isEqualTo(500);
+ assertThat(exchange.getMessage().getBody(String.class)).contains(FAILING_CONSUMER_DETAIL);
+ }
+
+ private Exchange invokeFailingConsumer(CloudEvent ce, String consumerUri) throws Exception {
+ configureKnativeComponent(
+ context,
+ ce,
+ sourceEndpoint(
+ "from",
+ Map.of(
+ Knative.KNATIVE_CLOUD_EVENT_TYPE, "org.apache.camel.event.from",
+ Knative.CONTENT_TYPE, "text/plain")),
+ endpoint(
+ Knative.EndpointKind.sink,
+ "to",
+ String.format("http://%s:%d", platformHttpHost, platformHttpPort),
+ Map.of(
+ Knative.KNATIVE_CLOUD_EVENT_TYPE, "org.apache.camel.event.to",
+ Knative.CONTENT_TYPE, "text/plain")));
+
+ RouteBuilder.addRoutes(context, b -> {
+ b.from(consumerUri)
+ .process(e -> {
+ throw new RuntimeException(FAILING_CONSUMER_DETAIL);
+ });
+ b.from("direct:source")
+ .to("knative://endpoint/to");
+ });
+
+ context.start();
+
+ return template.request("direct:source", e -> e.getMessage().setBody(""));
+ }
+
@ParameterizedTest
@EnumSource(CloudEvents.class)
void testEvents(CloudEvent ce) throws Exception {
diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
index c186c2be3976..9d3096659bdf 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
@@ -385,3 +385,26 @@ to `CamelIBMCOSCacheControl`, so the header name matches the Cache-Control metad
breaking change for routes that reference the header by its literal string name: they must switch to
`CamelIBMCOSCacheControl`, although the change is trivial to adapt. Routes using the
`IBMCOSConstants.CACHE_CONTROL` constant are unaffected.
+=== camel-knative
+
+The Knative HTTP consumer no longer returns the stack trace of a failed exchange to the caller.
+
+When a route consuming from `knative:endpoint/...` or `knative:event/...` failed, the response body was
+the exception's full stack trace, sent as `text/plain`. A new `muteException` consumer option controls
+this, and it defaults to `true` — the same default the HTTP consumers carry
+(`camel-http-common` and therefore `camel-servlet` and `camel-jetty`, plus `camel-http`,
+`camel-platform-http`, and `camel-netty-http` and `camel-undertow` since 4.21.0).
+
+The response status is unchanged: a failed exchange still returns 500 (or whatever
+`CamelHttpResponseCode` the route set), only the body is now empty.
+
+A route that relies on the stack trace reaching the caller must opt back in explicitly:
+
+[source,text]
+----
+knative:endpoint/myEndpoint?muteException=false
+----
+
+`org.apache.camel.component.knative.spi.KnativeTransportConfiguration` gains a fourth constructor
+argument for the flag. The three-argument constructor is retained and mutes the exception, so existing
+code compiles unchanged and picks up the new default.
diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/KnativeComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/KnativeComponentBuilderFactory.java
index b23e5bd41b8f..a8650f348075 100644
--- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/KnativeComponentBuilderFactory.java
+++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/KnativeComponentBuilderFactory.java
@@ -271,6 +271,24 @@ public interface KnativeComponentBuilderFactory {
}
+ /**
+ * If enabled and an Exchange failed processing on the consumer side the
+ * response's body won't contain the exception's stack trace.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: true
+ * Group: consumer
+ *
+ * @param muteException the value to set
+ * @return the dsl builder
+ */
+ default KnativeComponentBuilder muteException(boolean muteException) {
+ doSetProperty("muteException", muteException);
+ return this;
+ }
+
+
/**
* Transforms the reply into a cloud event that will be processed by the
* caller. When listening to events from a Knative Broker, if this flag
@@ -473,6 +491,7 @@ public interface KnativeComponentBuilderFactory {
case "transportOptions": getOrCreateConfiguration((KnativeComponent) component).setTransportOptions((java.util.Map) value); return true;
case "typeId": getOrCreateConfiguration((KnativeComponent) component).setTypeId((java.lang.String) value); return true;
case "bridgeErrorHandler": ((KnativeComponent) component).setBridgeErrorHandler((boolean) value); return true;
+ case "muteException": getOrCreateConfiguration((KnativeComponent) component).setMuteException((boolean) value); return true;
case "replyWithCloudEvent": getOrCreateConfiguration((KnativeComponent) component).setReplyWithCloudEvent((boolean) value); return true;
case "reply": getOrCreateConfiguration((KnativeComponent) component).setReply((java.lang.Boolean) value); return true;
case "lazyStartProducer": ((KnativeComponent) component).setLazyStartProducer((boolean) value); return true;
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KnativeEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KnativeEndpointBuilderFactory.java
index cde22c6f4f51..eeb860d74fc3 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KnativeEndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KnativeEndpointBuilderFactory.java
@@ -226,6 +226,38 @@ public interface KnativeEndpointBuilderFactory {
doSetProperty("transportOptions", transportOptions);
return this;
}
+ /**
+ * If enabled and an Exchange failed processing on the consumer side the
+ * response's body won't contain the exception's stack trace.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: true
+ * Group: consumer
+ *
+ * @param muteException the value to set
+ * @return the dsl builder
+ */
+ default KnativeEndpointConsumerBuilder muteException(boolean muteException) {
+ doSetProperty("muteException", muteException);
+ return this;
+ }
+ /**
+ * If enabled and an Exchange failed processing on the consumer side the
+ * response's body won't contain the exception's stack trace.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: true
+ * Group: consumer
+ *
+ * @param muteException the value to set
+ * @return the dsl builder
+ */
+ default KnativeEndpointConsumerBuilder muteException(String muteException) {
+ doSetProperty("muteException", muteException);
+ return this;
+ }
/**
* Transforms the reply into a cloud event that will be processed by the
* caller. When listening to events from a Knative Broker, if this flag