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

nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 567cf55064c4241411d3c9ba512b83cca068319e
Author: Nicolas Filotto <[email protected]>
AuthorDate: Wed Mar 30 17:40:19 2022 +0200

    CAMEL-17792: Add doc about the message headers of camel-jmx
---
 .../org/apache/camel/component/jmx/jmx.json        |  5 +++-
 .../camel-jmx/src/main/docs/jmx-component.adoc     |  4 ++-
 .../apache/camel/component/jmx/JMXConstants.java   | 29 ++++++++++++++++++++++
 .../apache/camel/component/jmx/JMXConsumer.java    |  6 ++---
 .../apache/camel/component/jmx/JMXEndpoint.java    |  4 +--
 5 files changed, 41 insertions(+), 7 deletions(-)

diff --git 
a/components/camel-jmx/src/generated/resources/org/apache/camel/component/jmx/jmx.json
 
b/components/camel-jmx/src/generated/resources/org/apache/camel/component/jmx/jmx.json
index fef71d5..69812b6 100644
--- 
a/components/camel-jmx/src/generated/resources/org/apache/camel/component/jmx/jmx.json
+++ 
b/components/camel-jmx/src/generated/resources/org/apache/camel/component/jmx/jmx.json
@@ -25,6 +25,9 @@
     "bridgeErrorHandler": { "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 processed as a me [...]
     "autowiredEnabled": { "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 type, which t [...]
   },
+  "headers": {
+    "jmx.handback": { "kind": "header", "displayName": "", "group": 
"consumer", "label": "consumer", "required": false, "javaType": "Object", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "The handback." }
+  },
   "properties": {
     "serverURL": { "kind": "path", "displayName": "Server URL", "group": 
"consumer", "label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Server url comes from the remaining endpoint. Use platform to 
connect to local JVM." },
     "bridgeErrorHandler": { "kind": "parameter", "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 processed as a m [...]
@@ -37,7 +40,7 @@
     "exceptionHandler": { "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 default the 
con [...]
     "exchangePattern": { "kind": "parameter", "displayName": "Exchange 
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", 
"InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, 
"description": "Sets the exchange pattern when the consumer creates an 
exchange." },
     "executorService": { "kind": "parameter", "displayName": "Executor 
Service", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "java.util.concurrent.ExecutorService", "deprecated": 
false, "autowired": false, "secret": false, "description": "To use a custom 
shared thread pool for the consumers. By default each consume has their own 
thread-pool to process and route notifications." },
-    "handback": { "kind": "parameter", "displayName": "Handback", "group": 
"advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.lang.Object", "deprecated": false, "autowired": false, 
"secret": false, "description": "Value to handback to the listener when a 
notification is received. This value will be put in the message header with the 
key jmx.handback" },
+    "handback": { "kind": "parameter", "displayName": "Handback", "group": 
"advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.lang.Object", "deprecated": false, "autowired": false, 
"secret": false, "description": "Value to handback to the listener when a 
notification is received. This value will be put in the message header with the 
key JMXConstants#JMX_HANDBACK." },
     "notificationFilter": { "kind": "parameter", "displayName": "Notification 
Filter", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "javax.management.NotificationFilter", "deprecated": 
false, "autowired": false, "secret": false, "description": "Reference to a bean 
that implements the NotificationFilter." },
     "objectProperties": { "kind": "parameter", "displayName": "Object 
Properties", "group": "advanced", "label": "advanced", "required": false, 
"type": "object", "javaType": "java.util.Map<java.lang.String, 
java.lang.String>", "prefix": "key.", "multiValue": true, "deprecated": false, 
"autowired": false, "secret": false, "description": "Properties for the object 
name. These values will be used if the objectName param is not set" },
     "reconnectDelay": { "kind": "parameter", "displayName": "Reconnect Delay", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 10, "description": "The number of seconds to wait before 
attempting to retry establishment of the initial connection or attempt to 
reconnect a lost connection" },
diff --git a/components/camel-jmx/src/main/docs/jmx-component.adoc 
b/components/camel-jmx/src/main/docs/jmx-component.adoc
index 47af7a8..c9d134c 100644
--- a/components/camel-jmx/src/main/docs/jmx-component.adoc
+++ b/components/camel-jmx/src/main/docs/jmx-component.adoc
@@ -39,7 +39,9 @@ include::partial$component-endpoint-options.adoc[]
 
 // endpoint options: END
 
-
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 
 include::spring-boot:partial$starter.adoc[]
diff --git 
a/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXConstants.java
 
b/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXConstants.java
new file mode 100644
index 0000000..6beabec
--- /dev/null
+++ 
b/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXConstants.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jmx;
+
+import org.apache.camel.spi.Metadata;
+
+public final class JMXConstants {
+
+    @Metadata(label = "consumer", description = "The handback.", javaType = 
"Object")
+    public static final String JMX_HANDBACK = "jmx.handback";
+
+    private JMXConstants() {
+
+    }
+}
diff --git 
a/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXConsumer.java
 
b/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXConsumer.java
index a2ed5dc..b4bca49 100644
--- 
a/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXConsumer.java
+++ 
b/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXConsumer.java
@@ -308,8 +308,8 @@ public class JMXConsumer extends DefaultConsumer implements 
NotificationListener
     }
 
     /**
-     * Processes the Notification received. The handback will be set as the 
header "jmx.handback" while the Notification
-     * will be set as the body.
+     * Processes the Notification received. The handback will be set as the 
header {@link JMXConstants#JMX_HANDBACK}
+     * while the Notification will be set as the body.
      * <p/>
      * If the format is set to "xml" then the Notification will be converted 
to XML first using
      * {@link NotificationXmlFormatter}
@@ -321,7 +321,7 @@ public class JMXConsumer extends DefaultConsumer implements 
NotificationListener
         JMXEndpoint ep = getEndpoint();
         Exchange exchange = createExchange(true);
         Message message = exchange.getIn();
-        message.setHeader("jmx.handback", aHandback);
+        message.setHeader(JMXConstants.JMX_HANDBACK, aHandback);
         try {
             if (ep.isXML()) {
                 message.setBody(getFormatter().format(aNotification));
diff --git 
a/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java
 
b/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java
index 4c1382e..2e71a75 100644
--- 
a/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java
+++ 
b/components/camel-jmx/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java
@@ -51,7 +51,7 @@ import org.apache.camel.util.ObjectHelper;
  * You can append query options to the URI in the following format, 
?options=value&option2=value&...
  */
 @UriEndpoint(firstVersion = "2.6.0", scheme = "jmx", title = "JMX", syntax = 
"jmx:serverURL", consumerOnly = true,
-             category = { Category.MONITORING })
+             category = { Category.MONITORING }, headersClass = 
JMXConstants.class)
 public class JMXEndpoint extends DefaultEndpoint {
 
     // error messages as constants so they can be asserted on from unit tests
@@ -204,7 +204,7 @@ public class JMXEndpoint extends DefaultEndpoint {
 
     /**
      * Value to handback to the listener when a notification is received. This 
value will be put in the message header
-     * with the key "jmx.handback"
+     * with the key {@link JMXConstants#JMX_HANDBACK}.
      */
     @UriParam(label = "advanced")
     private Object handback;

Reply via email to