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 a09643b302b5d4444545a3259b5381c4f368e515 Author: Nicolas Filotto <[email protected]> AuthorDate: Thu Mar 17 18:26:00 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-couchdb --- .../apache/camel/component/couchdb/couchdb.json | 7 +++++++ .../src/main/docs/couchdb-component.adoc | 22 +++------------------- .../camel/component/couchdb/CouchDbConstants.java | 8 ++++++++ .../camel/component/couchdb/CouchDbEndpoint.java | 2 +- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/components/camel-couchdb/src/generated/resources/org/apache/camel/component/couchdb/couchdb.json b/components/camel-couchdb/src/generated/resources/org/apache/camel/component/couchdb/couchdb.json index 9f4a1e5..b3f3a8c 100644 --- a/components/camel-couchdb/src/generated/resources/org/apache/camel/component/couchdb/couchdb.json +++ b/components/camel-couchdb/src/generated/resources/org/apache/camel/component/couchdb/couchdb.json @@ -26,6 +26,13 @@ "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] "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": { + "CouchDbDatabase": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The database the message came from" }, + "CouchDbSeq": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb changeset sequence number of the update \/ delete message" }, + "CouchDbId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document id" }, + "CouchDbRev": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The couchdb document revision" }, + "CouchDbMethod": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The method (delete \/ update)" } + }, "properties": { "protocol": { "kind": "path", "displayName": "Protocol", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "http", "https" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The protocol to use for communicating with the database." }, "hostname": { "kind": "path", "displayName": "Hostname", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Hostname of the running couchdb instance" }, diff --git a/components/camel-couchdb/src/main/docs/couchdb-component.adoc b/components/camel-couchdb/src/main/docs/couchdb-component.adoc index d17af7b..e247cae 100644 --- a/components/camel-couchdb/src/main/docs/couchdb-component.adoc +++ b/components/camel-couchdb/src/main/docs/couchdb-component.adoc @@ -67,25 +67,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END - -== Headers - -The following headers are set on exchanges during message transport. - -[width="100%",cols="20%,80%",options="header",] -|======================================================================= -|Property |Value - -|`CouchDbDatabase` |the database the message came from - -|`CouchDbSeq` |the couchdb changeset sequence number of the update / delete message - -|`CouchDbId` |the couchdb document id - -|`CouchDbRev` |the couchdb document revision - -|`CouchDbMethod` |the method (delete / update) -|======================================================================= +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END Headers are set by the consumer once the message is received. The producer will also set the headers for downstream processors once the diff --git a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConstants.java b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConstants.java index b177b19..0876e85 100644 --- a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConstants.java +++ b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConstants.java @@ -16,15 +16,23 @@ */ package org.apache.camel.component.couchdb; +import org.apache.camel.spi.Metadata; + /** * */ public interface CouchDbConstants { + @Metadata(label = "consumer", description = "The database the message came from", javaType = "String") String HEADER_DATABASE = "CouchDbDatabase"; + @Metadata(label = "consumer", description = "The couchdb changeset sequence number of the update / delete message", + javaType = "String") String HEADER_SEQ = "CouchDbSeq"; + @Metadata(description = "The couchdb document id", javaType = "String") String HEADER_DOC_ID = "CouchDbId"; + @Metadata(description = "The couchdb document revision", javaType = "String") String HEADER_DOC_REV = "CouchDbRev"; + @Metadata(description = "The method (delete / update)", javaType = "String") String HEADER_METHOD = "CouchDbMethod"; } diff --git a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java index a45d0c3..46d621c 100644 --- a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java +++ b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java @@ -34,7 +34,7 @@ import org.lightcouch.CouchDbClient; * documents from a CouchDB database. */ @UriEndpoint(firstVersion = "2.11.0", scheme = "couchdb", title = "CouchDB", syntax = "couchdb:protocol:hostname:port/database", - category = { Category.DATABASE, Category.NOSQL }) + category = { Category.DATABASE, Category.NOSQL }, headersClass = CouchDbConstants.class) public class CouchDbEndpoint extends DefaultEndpoint { public static final String DEFAULT_STYLE = "main_only";
