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:39 UTC

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

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 0dd443fed6248819a2d07018a004ab27f035fa08
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Mon Apr 4 12:41:56 2022 +0200

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

diff --git a/components/camel-paho-mqtt5/src/generated/resources/org/apache/camel/component/paho/mqtt5/paho-mqtt5.json b/components/camel-paho-mqtt5/src/generated/resources/org/apache/camel/component/paho/mqtt5/paho-mqtt5.json
index 90daee1b017..b0325b7a5bc 100644
--- a/components/camel-paho-mqtt5/src/generated/resources/org/apache/camel/component/paho/mqtt5/paho-mqtt5.json
+++ b/components/camel-paho-mqtt5/src/generated/resources/org/apache/camel/component/paho/mqtt5/paho-mqtt5.json
@@ -55,6 +55,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.mqtt5.PahoMqtt5Configuration", "configurationField": "configuration", "description": "Sets the HostnameVerifier for the SSL connection. Note that it will be used aft [...]
     "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.mqtt5.PahoMqtt5Configuration", "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." },
+    "CamelPahoMqtt5Qos": { "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)." },
+    "CamelPahoMqtt5Retained": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Retain option." },
+    "CamelPahoMqtt5OverrideTopic": { "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.mqtt5.PahoMqtt5Configuration", "configurationField": "configuration", "description": "Sets whether the client will automatically attempt to reconnect to the server if the connec [...]
diff --git a/components/camel-paho-mqtt5/src/main/docs/paho-mqtt5-component.adoc b/components/camel-paho-mqtt5/src/main/docs/paho-mqtt5-component.adoc
index 707df18b7e0..1584a4c839e 100644
--- a/components/camel-paho-mqtt5/src/main/docs/paho-mqtt5-component.adoc
+++ b/components/camel-paho-mqtt5/src/main/docs/paho-mqtt5-component.adoc
@@ -53,24 +53,13 @@ include::partial$component-endpoint-options.adoc[]
 
 // 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-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Constants.java b/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Constants.java
index b5235288675..3317fa364b1 100644
--- a/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Constants.java
+++ b/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Constants.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.paho.mqtt5;
 
+import org.apache.camel.spi.Metadata;
+
 /**
  * Constants to use when working with Paho MQTT 5 component.
  */
@@ -24,18 +26,25 @@ public final class PahoMqtt5Constants {
     /**
      * 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";
     public static final int DEFAULT_QOS = 2;
 
     public static final String CAMEL_PAHO = "CamelPahoMqtt5";
+    @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 PahoMqtt5Constants() {
diff --git a/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Endpoint.java b/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Endpoint.java
index 99908892341..33361d06012 100644
--- a/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Endpoint.java
+++ b/components/camel-paho-mqtt5/src/main/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5Endpoint.java
@@ -40,7 +40,7 @@ import org.eclipse.paho.mqttv5.common.MqttMessage;
  */
 @UriEndpoint(firstVersion = "3.8.0", scheme = "paho-mqtt5", title = "Paho MQTT 5",
              category = { Category.MESSAGING, Category.IOT },
-             syntax = "paho-mqtt5:topic")
+             syntax = "paho-mqtt5:topic", headersClass = PahoMqtt5Constants.class)
 public class PahoMqtt5Endpoint extends DefaultEndpoint {
 
     // Configuration members