You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/04/04 13:40:38 UTC

[camel] 01/08: CAMEL-17792: Add doc about the message headers of camel-paho

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 73ac8c539531c8a3cb0bdaee6167a8474d8c4abe
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Mon Apr 4 12:34:52 2022 +0200

    CAMEL-17792: Add doc about the message headers of camel-paho
---
 .../org/apache/camel/component/paho/paho.json         |  7 +++++++
 .../camel-paho/src/main/docs/paho-component.adoc      | 19 ++++---------------
 .../apache/camel/component/paho/PahoConstants.java    |  9 +++++++++
 .../org/apache/camel/component/paho/PahoEndpoint.java |  2 +-
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/components/camel-paho/src/generated/resources/org/apache/camel/component/paho/paho.json b/components/camel-paho/src/generated/resources/org/apache/camel/component/paho/paho.json
index 72bc2999bec..d34f4927c48 100644
--- a/components/camel-paho/src/generated/resources/org/apache/camel/component/paho/paho.json
+++ b/components/camel-paho/src/generated/resources/org/apache/camel/component/paho/paho.json
@@ -54,6 +54,13 @@
     "sslHostnameVerifier": { "kind": "property", "displayName": "Ssl Hostname Verifier", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "javax.net.ssl.HostnameVerifier", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.paho.PahoConfiguration", "configurationField": "configuration", "description": "Sets the HostnameVerifier for the SSL connection. Note that it will be used after handshak [...]
     "userName": { "kind": "property", "displayName": "User Name", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.paho.PahoConfiguration", "configurationField": "configuration", "description": "Username to be used for authentication against the MQTT broker" }
   },
+  "headers": {
+    "CamelMqttTopic": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the topic." },
+    "CamelMqttQoS": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The quality of service of the incoming message." },
+    "CamelPahoQos": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The client quality of service level (0-2)." },
+    "CamelPahoRetained": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Retain option." },
+    "CamelPahoOverrideTopic": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of topic to override and send to instead of topic specified on endpoint." }
+  },
   "properties": {
     "topic": { "kind": "path", "displayName": "Topic", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of the topic" },
     "automaticReconnect": { "kind": "parameter", "displayName": "Automatic Reconnect", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.paho.PahoConfiguration", "configurationField": "configuration", "description": "Sets whether the client will automatically attempt to reconnect to the server if the connection is los [...]
diff --git a/components/camel-paho/src/main/docs/paho-component.adoc b/components/camel-paho/src/main/docs/paho-component.adoc
index 7c9eaf49bba..c4550beb067 100644
--- a/components/camel-paho/src/main/docs/paho-component.adoc
+++ b/components/camel-paho/src/main/docs/paho-component.adoc
@@ -53,25 +53,14 @@ include::partial$component-endpoint-options.adoc[]
 // endpoint options: START
 
 // endpoint options: END
-
-
-== Headers
-
-The following headers are recognized by the Paho component:
-
-[width="100%",cols="10%,10%,10%,10%,60%",options="header",]
-|===
-|Header |Java constant |Endpoint type |Value type |Description
-
-|CamelMqttTopic |PahoConstants.MQTT_TOPIC |Consumer |String |The name of the topic
-|CamelMqttQoS |PahoConstants.MQTT_QOS |Consumer |Integer |QualityOfService of the incoming message
-|CamelPahoOverrideTopic |PahoConstants.CAMEL_PAHO_OVERRIDE_TOPIC |Producer |String |Name of topic to override and send to instead of topic specified on endpoint
-|===
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 
 == Default payload type
 
-By default Camel Paho component operates on the binary payloads
+By default, Camel Paho component operates on the binary payloads
 extracted out of (or put into) the MQTT message:
 
 [source,java]
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
index 0287add3f56..3393888cd96 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoConstants.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.paho;
 
+import org.apache.camel.spi.Metadata;
+
 /**
  * Constants to use when working with Paho component.
  */
@@ -24,10 +26,12 @@ public final class PahoConstants {
     /**
      * Header indicating a topic of a MQTT message.
      */
+    @Metadata(label = "consumer", description = "The name of the topic.", javaType = "String")
     public static final String MQTT_TOPIC = "CamelMqttTopic";
     /**
      * Header indicating a QoS of a MQTT message.
      */
+    @Metadata(label = "consumer", description = "The quality of service of the incoming message.", javaType = "Integer")
     public static final String MQTT_QOS = "CamelMqttQoS";
 
     public static final String DEFAULT_BROKER_URL = "tcp://localhost:1883";
@@ -36,8 +40,13 @@ public final class PahoConstants {
     @Deprecated
     public static final String HEADER_ORIGINAL_MESSAGE = "PahoOriginalMessage";
     public static final String CAMEL_PAHO = "CamelPaho";
+    @Metadata(label = "producer", description = "The client quality of service level (0-2).", javaType = "Integer")
     public static final String CAMEL_PAHO_MSG_QOS = CAMEL_PAHO + "Qos";
+    @Metadata(label = "producer", description = "Retain option.", javaType = "Boolean")
     public static final String CAMEL_PAHO_MSG_RETAINED = CAMEL_PAHO + "Retained";
+    @Metadata(label = "producer",
+              description = "The name of topic to override and send to instead of topic specified on endpoint.",
+              javaType = "String")
     public static final String CAMEL_PAHO_OVERRIDE_TOPIC = CAMEL_PAHO + "OverrideTopic";
 
     private PahoConstants() {
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
index d8852046e40..8c8fc9a64cb 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
@@ -36,7 +36,7 @@ import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
  * Communicate with MQTT message brokers using Eclipse Paho MQTT Client.
  */
 @UriEndpoint(firstVersion = "2.16.0", scheme = "paho", title = "Paho", category = { Category.MESSAGING, Category.IOT },
-             syntax = "paho:topic")
+             syntax = "paho:topic", headersClass = PahoConstants.class)
 public class PahoEndpoint extends DefaultEndpoint {
 
     // Configuration members