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/03/17 18:32:16 UTC
[camel] 09/13: CAMEL-17792: Add doc about the message headers of camel-consul
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 66ac2757d84c36ff815435176b56e51a7ea9f6b7
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Thu Mar 17 17:15:10 2022 +0100
CAMEL-17792: Add doc about the message headers of camel-consul
---
.../org/apache/camel/component/consul/consul.json | 33 ++++++++++++++++++++
.../src/main/docs/consul-component.adoc | 29 ++---------------
.../camel/component/consul/ConsulConstants.java | 36 ++++++++++++++++++++++
.../camel/component/consul/ConsulEndpoint.java | 2 +-
4 files changed, 73 insertions(+), 27 deletions(-)
diff --git a/components/camel-consul/src/generated/resources/org/apache/camel/component/consul/consul.json b/components/camel-consul/src/generated/resources/org/apache/camel/component/consul/consul.json
index 31d576b..18c62b0 100644
--- a/components/camel-consul/src/generated/resources/org/apache/camel/component/consul/consul.json
+++ b/components/camel-consul/src/generated/resources/org/apache/camel/component/consul/consul.json
@@ -52,6 +52,39 @@
"firstIndex": { "kind": "property", "displayName": "First Index", "group": "watch", "label": "consumer,watch", "required": false, "type": "object", "javaType": "java.math.BigInteger", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "0", "configurationClass": "org.apache.camel.component.consul.ConsulConfiguration", "configurationField": "configuration", "description": "The first index for watch for, default 0" },
"recursive": { "kind": "property", "displayName": "Recursive", "group": "watch", "label": "consumer,watch", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.consul.ConsulConfiguration", "configurationField": "configuration", "description": "Recursively watch, default false" }
},
+ "headers": {
+ "CamelConsulAction": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Producer action" },
+ "CamelConsulKey": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Key on which the action should applied" },
+ "CamelConsulEventId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event id" },
+ "CamelConsulEventName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event name" },
+ "CamelConsulEventLTime": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event LTime" },
+ "CamelConsulNodeFilter": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Node filter" },
+ "CamelConsulTagFilter": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The tag filter" },
+ "CamelConsulSessionFilter": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The session filter" },
+ "CamelConsulVersion": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The data version" },
+ "CamelConsulFlags": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Flags associated with a value" },
+ "CamelConsulIndex": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "BigInteger", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The optional value index" },
+ "CamelConsulWait": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The optional value wait" },
+ "CamelConsulCreateIndex": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The internal index value that represents when the entry was created" },
+ "CamelConsulLockIndex": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The number of times this key has successfully been acquired in a lock" },
+ "CamelConsulModifyIndex": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The last index that modified this key" },
+ "CamelConsulOptions": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Options associated to the request" },
+ "CamelConsulResult": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "true if the response has a result" },
+ "CamelConsulSession": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The session id" },
+ "CamelConsulValueAsString": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "To transform values retrieved from Consul i.e. on KV endpoint to string." },
+ "CamelConsulNode": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The node" },
+ "CamelConsulService": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The service" },
+ "CamelConsulDatacenter": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The data center" },
+ "CamelConsulNearNode": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The near node to use for queries." },
+ "CamelConsulNodeMeta": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "List<String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The note meta-data to use for queries." },
+ "CamelConsulLastContact": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The last contact" },
+ "CamelConsulKnownLeader": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Indicates whether it is the known leader" },
+ "CamelConsulConsistencyMode": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "com.orbitz.consul.option.ConsistencyMode", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The consistencyMode used for queries" },
+ "CamelConsulHealthyOnly": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "false", "description": "Only on healthy services" },
+ "CamelConsulHealthyState": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "com.orbitz.consul.model.State", "enum": [ "PASS", "WARN", "FAIL", "ANY", "UNKNOWN" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The state to query." },
+ "CamelConsulPreparedQueryID": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The id of the prepared query" },
+ "CamelConsulServiceId": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The service id for agent deregistration" }
+ },
"properties": {
"apiEndpoint": { "kind": "path", "displayName": "Api Endpoint", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The API endpoint" },
"connectTimeout": { "kind": "parameter", "displayName": "Connect Timeout", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.time.Duration", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.consul.ConsulConfiguration", "configurationField": "configuration", "description": "Connect timeout for OkHttpClient" },
diff --git a/components/camel-consul/src/main/docs/consul-component.adoc b/components/camel-consul/src/main/docs/consul-component.adoc
index 9535110..00a5e85 100644
--- a/components/camel-consul/src/main/docs/consul-component.adoc
+++ b/components/camel-consul/src/main/docs/consul-component.adoc
@@ -46,32 +46,9 @@ include::partial$component-endpoint-options.adoc[]
// endpoint options: END
-
-
-== Headers
-
-[width="100%",options="header"]
-|=======================================================================
-|Name |Type |Description
-|CamelConsulAction|String|The Producer action
-|CamelConsulKey|String|The Key on which the action should applied
-|CamelConsulEventId|String|The event id (consumer only)
-|CamelConsulEventName|String|The event name (consumer only)
-|CamelConsulEventLTime|Long|The event LTime
-|CamelConsulNodeFilter|String|The Node filter
-|CamelConsulTagFilter|String|The tag filter
-|CamelConsulSessionFilter|String|The session filter
-|CamelConsulVersion|int|The data version
-|CamelConsulFlags|Long|Flags associated with a value
-|CamelConsulCreateIndex|Long|The internal index value that represents when the entry was created
-|CamelConsulLockIndex|Long|The number of times this key has successfully been acquired in a lock
-|CamelConsulModifyIndex|Long|The last index that modified this key
-|CamelConsulOptions|Object|Options associated to the request
-|CamelConsulResult|boolean|true if the response has a result
-|CamelConsulSession|String|The session id
-|CamelConsulValueAsString|boolean|To transform values retrieved from Consul i.e. on KV endpoint to string.
-|CamelConsulServiceId|String|The service id for agent deregistration
-|=======================================================================
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
== Api Endpoint
diff --git a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulConstants.java b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulConstants.java
index 29bb5ad..9d7f565 100644
--- a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulConstants.java
+++ b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulConstants.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.consul;
import com.orbitz.consul.Consul;
+import org.apache.camel.spi.Metadata;
public interface ConsulConstants {
String CONSUL_DEFAULT_URL = String.format("http://%s:%d", Consul.DEFAULT_HTTP_HOST, Consul.DEFAULT_HTTP_PORT);
@@ -25,35 +26,70 @@ public interface ConsulConstants {
String CONSUL_SERVER_IP = "CamelConsulServerIp";
String CONSUL_SERVER_PORT = "CamelConsulServerPort";
+ @Metadata(label = "producer", description = "The Producer action", javaType = "String")
String CONSUL_ACTION = "CamelConsulAction";
+ @Metadata(description = "The Key on which the action should applied", javaType = "String")
String CONSUL_KEY = "CamelConsulKey";
+ @Metadata(label = "consumer", description = "The event id", javaType = "String")
String CONSUL_EVENT_ID = "CamelConsulEventId";
+ @Metadata(label = "consumer", description = "The event name", javaType = "String")
String CONSUL_EVENT_NAME = "CamelConsulEventName";
+ @Metadata(label = "consumer", description = "The event LTime", javaType = "Long")
String CONSUL_EVENT_LTIME = "CamelConsulEventLTime";
+ @Metadata(label = "consumer", description = "The Node filter", javaType = "String")
String CONSUL_NODE_FILTER = "CamelConsulNodeFilter";
+ @Metadata(label = "consumer", description = "The tag filter", javaType = "String")
String CONSUL_TAG_FILTER = "CamelConsulTagFilter";
+ @Metadata(label = "consumer", description = "The session filter", javaType = "String")
String CONSUL_SERVICE_FILTER = "CamelConsulSessionFilter";
+ @Metadata(label = "consumer", description = "The data version", javaType = "Integer")
String CONSUL_VERSION = "CamelConsulVersion";
+ @Metadata(description = "Flags associated with a value", javaType = "Long")
String CONSUL_FLAGS = "CamelConsulFlags";
+ @Metadata(label = "producer", description = "The optional value index", javaType = "BigInteger")
String CONSUL_INDEX = "CamelConsulIndex";
+ @Metadata(label = "producer", description = "The optional value wait", javaType = "String")
String CONSUL_WAIT = "CamelConsulWait";
+ @Metadata(label = "consumer", description = "The internal index value that represents when the entry was created",
+ javaType = "Long")
String CONSUL_CREATE_INDEX = "CamelConsulCreateIndex";
+ @Metadata(label = "consumer", description = "The number of times this key has successfully been acquired in a lock",
+ javaType = "Long")
String CONSUL_LOCK_INDEX = "CamelConsulLockIndex";
+ @Metadata(label = "consumer", description = "The last index that modified this key", javaType = "Long")
String CONSUL_MODIFY_INDEX = "CamelConsulModifyIndex";
+ @Metadata(description = "Options associated to the request")
String CONSUL_OPTIONS = "CamelConsulOptions";
+ @Metadata(description = "true if the response has a result", javaType = "Boolean")
String CONSUL_RESULT = "CamelConsulResult";
+ @Metadata(description = "The session id", javaType = "String")
String CONSUL_SESSION = "CamelConsulSession";
+ @Metadata(label = "producer", description = "To transform values retrieved from Consul i.e. on KV endpoint to string.",
+ javaType = "Boolean")
String CONSUL_VALUE_AS_STRING = "CamelConsulValueAsString";
+ @Metadata(label = "producer", description = "The node", javaType = "String")
String CONSUL_NODE = "CamelConsulNode";
+ @Metadata(label = "producer", description = "The service", javaType = "String")
String CONSUL_SERVICE = "CamelConsulService";
+ @Metadata(label = "producer", description = "The data center", javaType = "String")
String CONSUL_DATACENTER = "CamelConsulDatacenter";
+ @Metadata(label = "producer", description = "The near node to use for queries.", javaType = "String")
String CONSUL_NEAR_NODE = "CamelConsulNearNode";
+ @Metadata(label = "producer", description = "The note meta-data to use for queries.", javaType = "List<String>")
String CONSUL_NODE_META = "CamelConsulNodeMeta";
+ @Metadata(label = "producer", description = "The last contact", javaType = "Long")
String CONSUL_LAST_CONTACT = "CamelConsulLastContact";
+ @Metadata(label = "producer", description = "Indicates whether it is the known leader", javaType = "Boolean")
String CONSUL_KNOWN_LEADER = "CamelConsulKnownLeader";
+ @Metadata(label = "producer", description = "The consistencyMode used for queries",
+ javaType = "com.orbitz.consul.option.ConsistencyMode", defaultValue = "DEFAULT")
String CONSUL_CONSISTENCY_MODE = "CamelConsulConsistencyMode";
+ @Metadata(label = "producer", description = "Only on healthy services", javaType = "Boolean", defaultValue = "false")
String CONSUL_HEALTHY_ONLY = "CamelConsulHealthyOnly";
+ @Metadata(label = "producer", description = "The state to query.", javaType = "com.orbitz.consul.model.State")
String CONSUL_HEALTHY_STATE = "CamelConsulHealthyState";
+ @Metadata(label = "producer", description = "The id of the prepared query", javaType = "String")
String CONSUL_PREPARED_QUERY_ID = "CamelConsulPreparedQueryID";
+ @Metadata(label = "producer", description = "The service id for agent deregistration", javaType = "String")
String CONSUL_SERVICE_ID = "CamelConsulServiceId";
}
diff --git a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulEndpoint.java b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulEndpoint.java
index c22b8c0..dce77df 100644
--- a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulEndpoint.java
+++ b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulEndpoint.java
@@ -34,7 +34,7 @@ import org.apache.camel.util.ObjectHelper;
* Integrate with <a href="https://www.consul.io/">Consul</a> service discovery and configuration store.
*/
@UriEndpoint(firstVersion = "2.18.0", scheme = "consul", title = "Consul", syntax = "consul:apiEndpoint",
- category = { Category.CLOUD, Category.API })
+ category = { Category.CLOUD, Category.API }, headersClass = ConsulConstants.class)
public class ConsulEndpoint extends DefaultEndpoint {
@UriParam