You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/08/31 14:56:53 UTC

[camel-spring-boot] branch main updated: CAMEL-19817: camel-timer - Remove firedTime header and turn off metadata headers by default to make the exchange empty, and avoid leaking unwanted headers by default. Add backwards compatible option on component to turn this on globally.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new c79d1b01fa3 CAMEL-19817: camel-timer - Remove firedTime header and turn off metadata headers by default to make the exchange empty, and avoid leaking unwanted headers by default. Add backwards compatible option on component to turn this on globally.
c79d1b01fa3 is described below

commit c79d1b01fa3da7e2929b9bd917eae8f58e6a97f3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 31 16:38:27 2023 +0200

    CAMEL-19817: camel-timer - Remove firedTime header and turn off metadata headers by default to make the exchange empty, and avoid leaking unwanted headers by default. Add backwards compatible option on component to turn this on globally.
---
 .../org/apache/camel/springboot/catalog/components/pdf.json |  2 +-
 .../apache/camel/springboot/catalog/components/timer.json   |  7 ++++---
 .../camel-timer-starter/src/main/docs/timer.json            |  7 +++++++
 .../timer/springboot/TimerComponentConfiguration.java       | 13 +++++++++++++
 4 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/pdf.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/pdf.json
index 4f3b0988949..1f51e377ae8 100644
--- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/pdf.json
+++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/pdf.json
@@ -32,7 +32,7 @@
   },
   "properties": {
     "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.pdf.PdfOperation", "enum": [ "create", "append", "extractText" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pdf.PdfConfiguration", "configurationField": "pdfConfiguration", "description": "Operation type" },
-    "font": { "index": 1, "kind": "parameter", "displayName": "Font", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique", "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique", "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", "Symbol", "ZapfDingbats" ], "deprecated": false, "autowired": false, "secret": false, "defaultValu [...]
+    "font": { "index": 1, "kind": "parameter", "displayName": "Font", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "COURIER", "COURIER_BOLD", "COURIER_OBLIQUE", "COURIER_BOLD_OBLIQUE", "HELVETICA", "HELVETICA_BOLD", "HELVETICA_OBLIQUE", "HELVETICA_BOLD_OBLIQUE", "TIMES_ROMAN", "TIMES_BOLD", "TIMES_ITALIC", "TIMES_BOLD_ITALIC", "SYMBOL", "ZAPF_DINGBATS" ], "deprecated": false, "autowired": false, "secret": false, "default [...]
     "fontSize": { "index": 2, "kind": "parameter", "displayName": "Font Size", "group": "producer", "label": "", "required": false, "type": "number", "javaType": "float", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 14.0, "configurationClass": "org.apache.camel.component.pdf.PdfConfiguration", "configurationField": "pdfConfiguration", "description": "Font size in pixels" },
     "marginBottom": { "index": 3, "kind": "parameter", "displayName": "Margin Bottom", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 20, "configurationClass": "org.apache.camel.component.pdf.PdfConfiguration", "configurationField": "pdfConfiguration", "description": "Margin bottom in pixels" },
     "marginLeft": { "index": 4, "kind": "parameter", "displayName": "Margin Left", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 20, "configurationClass": "org.apache.camel.component.pdf.PdfConfiguration", "configurationField": "pdfConfiguration", "description": "Margin left in pixels" },
diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/timer.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/timer.json
index 75113af0163..8c31b84abdf 100644
--- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/timer.json
+++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/timer.json
@@ -23,17 +23,18 @@
   },
   "componentProperties": {
     "bridgeErrorHandler": { "index": 0, "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 occurred while the consumer is trying to pickup incoming messages, or the likes, will now be proce [...]
-    "autowiredEnabled": { "index": 1, "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 t [...]
+    "includeMetadata": { "index": 1, "kind": "property", "displayName": "Include Metadata", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to include metadata in the exchange such as fired time, timer name, timer count etc." },
+    "autowiredEnabled": { "index": 2, "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 t [...]
   },
   "headers": {
-    "firedTime": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The fired time", "constantName": "org.apache.camel.component.timer.TimerConstants#HEADER_FIRED_TIME" },
+    "CamelTimerFiredTime": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The fired time", "constantName": "org.apache.camel.component.timer.TimerConstants#HEADER_FIRED_TIME" },
     "CamelMessageTimestamp": { "index": 1, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The timestamp of the message", "constantName": "org.apache.camel.component.timer.TimerConstants#HEADER_MESSAGE_TIMESTAMP" }
   },
   "properties": {
     "timerName": { "index": 0, "kind": "path", "displayName": "Timer Name", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the timer" },
     "delay": { "index": 1, "kind": "parameter", "displayName": "Delay", "group": "consumer", "label": "", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1000", "description": "Delay before first event is triggered." },
     "fixedRate": { "index": 2, "kind": "parameter", "displayName": "Fixed Rate", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Events take place at approximately regular intervals, separated by the specified period." },
-    "includeMetadata": { "index": 3, "kind": "parameter", "displayName": "Include Metadata", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to include metadata in the exchange such as fired time, timer name, timer count etc. This information is default included." },
+    "includeMetadata": { "index": 3, "kind": "parameter", "displayName": "Include Metadata", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to include metadata in the exchange such as fired time, timer name, timer count etc." },
     "period": { "index": 4, "kind": "parameter", "displayName": "Period", "group": "consumer", "label": "", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1000", "description": "If greater than 0, generate periodic events every period." },
     "repeatCount": { "index": 5, "kind": "parameter", "displayName": "Repeat Count", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "description": "Specifies a maximum limit of number of fires. So if you set it to 1, the timer will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever." },
     "bridgeErrorHandler": { "index": 6, "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 occurred while the consumer is trying to pickup incoming messages, or the lik [...]
diff --git a/components-starter/camel-timer-starter/src/main/docs/timer.json b/components-starter/camel-timer-starter/src/main/docs/timer.json
index b5318c774c1..c865e242da2 100644
--- a/components-starter/camel-timer-starter/src/main/docs/timer.json
+++ b/components-starter/camel-timer-starter/src/main/docs/timer.json
@@ -37,6 +37,13 @@
       "type": "java.lang.Boolean",
       "description": "Whether to enable auto configuration of the timer component. This is enabled by default.",
       "sourceType": "org.apache.camel.component.timer.springboot.TimerComponentConfiguration"
+    },
+    {
+      "name": "camel.component.timer.include-metadata",
+      "type": "java.lang.Boolean",
+      "description": "Whether to include metadata in the exchange such as fired time, timer name, timer count etc.",
+      "sourceType": "org.apache.camel.component.timer.springboot.TimerComponentConfiguration",
+      "defaultValue": false
     }
   ],
   "hints": []
diff --git a/components-starter/camel-timer-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentConfiguration.java b/components-starter/camel-timer-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentConfiguration.java
index 0c8bae67075..f0a5ebf7dbb 100644
--- a/components-starter/camel-timer-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentConfiguration.java
+++ b/components-starter/camel-timer-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentConfiguration.java
@@ -43,6 +43,11 @@ public class TimerComponentConfiguration
      * will be logged at WARN or ERROR level and ignored.
      */
     private Boolean bridgeErrorHandler = false;
+    /**
+     * Whether to include metadata in the exchange such as fired time, timer
+     * name, timer count etc.
+     */
+    private Boolean includeMetadata = false;
     /**
      * Whether autowiring is enabled. This is used for automatic autowiring
      * options (the option must be marked as autowired) by looking up in the
@@ -61,6 +66,14 @@ public class TimerComponentConfiguration
         this.bridgeErrorHandler = bridgeErrorHandler;
     }
 
+    public Boolean getIncludeMetadata() {
+        return includeMetadata;
+    }
+
+    public void setIncludeMetadata(Boolean includeMetadata) {
+        this.includeMetadata = includeMetadata;
+    }
+
     public Boolean getAutowiredEnabled() {
         return autowiredEnabled;
     }