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 1d2d7d007f6744a39cd7da4fef5075a74c7dae41 Author: Nicolas Filotto <[email protected]> AuthorDate: Fri Apr 1 15:22:00 2022 +0200 CAMEL-17792: Add doc about the message headers of camel-nitrite --- .../apache/camel/component/nitrite/nitrite.json | 6 ++++++ .../src/main/docs/nitrite-component.adoc | 25 +++------------------- .../camel/component/nitrite/NitriteConstants.java | 8 +++++++ .../camel/component/nitrite/NitriteEndpoint.java | 2 +- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/components/camel-nitrite/src/generated/resources/org/apache/camel/component/nitrite/nitrite.json b/components/camel-nitrite/src/generated/resources/org/apache/camel/component/nitrite/nitrite.json index 3a5ca16..00b4399 100644 --- a/components/camel-nitrite/src/generated/resources/org/apache/camel/component/nitrite/nitrite.json +++ b/components/camel-nitrite/src/generated/resources/org/apache/camel/component/nitrite/nitrite.json @@ -26,6 +26,12 @@ "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": { + "CamelNitriteChangeTimestamp": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Event timestamp in Epoch millis." }, + "CamelNitriteChangeType": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "org.dizitart.no2.event.ChangeType", "enum": [ "INSERT", "UPDATE", "REMOVE", "DROP", "CLOSE" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Type of event." }, + "CamelNitriteOperation": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.nitrite.AbstractNitriteOperation", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to invoke on Collection or Repository. Defaults to UpsertOperation if not specified." }, + "CamelNitriteWriteResult": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "org.dizitart.no2.WriteResult", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Result of data modifying operation." } + }, "properties": { "database": { "kind": "path", "displayName": "Database", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Path to database file. Will be created if not exists." }, "collection": { "kind": "parameter", "displayName": "Collection", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of Nitrite collection. Cannot be used in combination with repositoryClass option." }, diff --git a/components/camel-nitrite/src/main/docs/nitrite-component.adoc b/components/camel-nitrite/src/main/docs/nitrite-component.adoc index c7c9cce..19b0e96 100644 --- a/components/camel-nitrite/src/main/docs/nitrite-component.adoc +++ b/components/camel-nitrite/src/main/docs/nitrite-component.adoc @@ -42,28 +42,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END - -== Message headers - -=== Consumer headers - -The following headers are available when consuming from Nitrite. -[width="100%",cols="2m,2m,1m,5",options="header"] -|=== -| Header constant | Header value | Type | Description -| NitriteConstants.CHANGE_TIMESTAMP | "CamelNitriteChangeTimestamp" | Long | Event timestamp in Epoch millis -| NitriteConstants.CHANGE_TYPE | "CamelNitriteChangeType" | org.dizitart.no2.event.ChangeType | Type of event -|=== - -=== Producer headers - -The following headers are available when producing to Nitrite. -[width="100%",cols="2m,2m,1m,5",options="header"] -|=== -| Header constant | Header value | Type | Description -| NitriteConstants.OPERATION | "CamelNitriteOperation" | AbstractNitriteOperation | Operation to invoke on Collection or Repository. Defaults to `UpsertOperation` if not specified -| NitriteConstants.WRITE_RESULT | "CamelNitriteWriteResult" | org.dizitart.no2.WriteResult | Result of data modifying operation -|=== +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Producer operations The following Operations are available to specify as NitriteConstants.OPERATION when producing to Nitrite. diff --git a/components/camel-nitrite/src/main/java/org/apache/camel/component/nitrite/NitriteConstants.java b/components/camel-nitrite/src/main/java/org/apache/camel/component/nitrite/NitriteConstants.java index a9db3eb..7a6916f 100644 --- a/components/camel-nitrite/src/main/java/org/apache/camel/component/nitrite/NitriteConstants.java +++ b/components/camel-nitrite/src/main/java/org/apache/camel/component/nitrite/NitriteConstants.java @@ -16,10 +16,18 @@ */ package org.apache.camel.component.nitrite; +import org.apache.camel.spi.Metadata; + public final class NitriteConstants { + @Metadata(label = "consumer", description = "Event timestamp in Epoch millis.", javaType = "long") public static final String CHANGE_TIMESTAMP = "CamelNitriteChangeTimestamp"; + @Metadata(label = "consumer", description = "Type of event.", javaType = "org.dizitart.no2.event.ChangeType") public static final String CHANGE_TYPE = "CamelNitriteChangeType"; + @Metadata(label = "producer", + description = "Operation to invoke on Collection or Repository. Defaults to `UpsertOperation` if not specified.", + javaType = "org.apache.camel.component.nitrite.AbstractNitriteOperation") public static final String OPERATION = "CamelNitriteOperation"; + @Metadata(description = "Result of data modifying operation.", javaType = "org.dizitart.no2.WriteResult") public static final String WRITE_RESULT = "CamelNitriteWriteResult"; private NitriteConstants() { diff --git a/components/camel-nitrite/src/main/java/org/apache/camel/component/nitrite/NitriteEndpoint.java b/components/camel-nitrite/src/main/java/org/apache/camel/component/nitrite/NitriteEndpoint.java index e5cb92b..007e5eb 100644 --- a/components/camel-nitrite/src/main/java/org/apache/camel/component/nitrite/NitriteEndpoint.java +++ b/components/camel-nitrite/src/main/java/org/apache/camel/component/nitrite/NitriteEndpoint.java @@ -32,7 +32,7 @@ import org.dizitart.no2.PersistentCollection; * Access Nitrite databases. */ @UriEndpoint(firstVersion = "3.0.0", scheme = "nitrite", title = "Nitrite", syntax = "nitrite:database", - category = { Category.DATABASE, Category.NOSQL }) + category = { Category.DATABASE, Category.NOSQL }, headersClass = NitriteConstants.class) public class NitriteEndpoint extends DefaultEndpoint { @UriPath(label = "common", description = "Path to database file. Will be created if not exists.") @Metadata(required = true)
