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/05 16:15:05 UTC
[camel] 18/20: CAMEL-17792: Add doc about the message headers of camel-stitch
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 260dfba7460892f5cf168495b433076c94971bd0
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Apr 5 17:57:12 2022 +0200
CAMEL-17792: Add doc about the message headers of camel-stitch
---
.../org/apache/camel/component/stitch/stitch.json | 8 +++++
.../src/main/docs/stitch-component.adoc | 35 ++--------------------
.../camel/component/stitch/StitchConstants.java | 20 +++++++++++++
.../camel/component/stitch/StitchEndpoint.java | 3 +-
4 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/components/camel-stitch/src/generated/resources/org/apache/camel/component/stitch/stitch.json b/components/camel-stitch/src/generated/resources/org/apache/camel/component/stitch/stitch.json
index b9bb6222172..3178a97d433 100644
--- a/components/camel-stitch/src/generated/resources/org/apache/camel/component/stitch/stitch.json
+++ b/components/camel-stitch/src/generated/resources/org/apache/camel/component/stitch/stitch.json
@@ -33,6 +33,14 @@
"stitchClient": { "kind": "property", "displayName": "Stitch Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.stitch.client.StitchClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.stitch.StitchConfiguration", "configurationField": "configuration", "description": "Set a custom StitchClient that implements org.apache.cam [...]
"token": { "kind": "property", "displayName": "Token", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.stitch.StitchConfiguration", "configurationField": "configuration", "description": "Stitch access token for the Stitch Import API" }
},
+ "headers": {
+ "CamelStitchTableName": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issues will occur. Note: The number of characters in the table name should be within the destinations allowed limits [...]
+ "CamelStitchSchema": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "StitchSchema or Map", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The schema that describes the Stitch message" },
+ "CamelStitchKeyNames": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Collection<String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A collection of strings representing the Primary Key fields in the source table. Stitch use these Primary Keys to de-dupe data during loading If not provided, the table will be loaded in an append-only manner." },
+ "CamelStitchCode": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "HTTP Status code that is returned from Stitch Import HTTP API." },
+ "CamelStitchHeaders": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "HTTP headers that are returned from Stitch Import HTTP API." },
+ "CamelStitchStatus": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The status message that Stitch returns after sending the data through Stitch Import API." }
+ },
"properties": {
"tableName": { "kind": "path", "displayName": "Table Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.stitch.StitchConfiguration", "configurationField": "configuration", "description": "The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issu [...]
"keyNames": { "kind": "parameter", "displayName": "Key Names", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.stitch.StitchConfiguration", "configurationField": "configuration", "description": "A collection of comma separated strings representing the Primary Key fields in the source table. Stitch use these Primary [...]
diff --git a/components/camel-stitch/src/main/docs/stitch-component.adoc b/components/camel-stitch/src/main/docs/stitch-component.adoc
index 2985697a540..6fd00a1fc63 100644
--- a/components/camel-stitch/src/main/docs/stitch-component.adoc
+++ b/components/camel-stitch/src/main/docs/stitch-component.adoc
@@ -45,9 +45,6 @@ for this component:
stitch:[tableName]//[?options]
------------------------------
-
-
-
// component-configure options: START
// component-configure options: END
@@ -60,7 +57,9 @@ include::partial$component-endpoint-options.adoc[]
// endpoint options: START
// endpoint options: END
-
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
== Async Producer
@@ -92,30 +91,6 @@ from("direct:sendStitch")
.to("stitch:table_1?token=RAW({{token}})");
--------------------------------------------------------------------------------
-=== Message headers evaluated by the component producer
-Before sending a message to Stitch component you can configure the following headers.
-
-[width="100%",cols="10%,10%,10%,70%",options="header",]
-|=======================================================================
-|Header |Variable Name |Type |Description
-
-|`CamelStitchTableName`| `StitchConstants.TABLE_NAME`|`String`| The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issues will occur. Note: The number of characters in the table name should be within the destinations allowed limits or data will rejected.
-|`CamelStitchSchema`| `StitchConstants.SCHEMA`|`StitchSchema`| The schema that describes the Stitch message of type `org.apache.camel.component.stitch.client.models.StitchSchema`
-|`CamelStitchKeyNames`| `StitchConstants.KEY_NAMES`|`Collection<String>`| A collection of strings representing the Primary Key fields in the source table. Stitch use these Primary Keys to de-dupe data during loading If not provided, the table will be loaded in an append-only manner.
-|=======================================================================
-
-=== Message headers set by the component producer
-After the message is sent to Stitch, the following headers are available
-
-[width="100%",cols="10%,10%,10%,70%",options="header",]
-|=======================================================================
-|Header |Variable Name |Type |Description
-
-|`CamelStitchCode`| `StitchConstants.CODE`|`Integer`| HTTP Status code that is returned from Stitch Import HTTP API.
-|`CamelStitchHeaders`| `StitchConstants.HEADERS`|`Map`| HTTP headers that are returned from Stitch Import HTTP API.
-|`CamelStitchStatus`| `StitchConstants.STATUS`|`String`| The status message that Stitch returns after sending the data through Stitch Import API.
-|=======================================================================
-
=== Message body type
Currently, the component supports the following types for the body message on the producer side when producing a message to Stitch component:
@@ -132,8 +107,6 @@ If you choose to send your message as `StitchMessage`, *you will need* to add `t
* `Iterable`: You can send multiple Stitch messages that are aggregated by Camel or aggregated through custom processor. These aggregated messages
can be type of `StitchMessage`, `StitchRequestBody` or `Map` but this Map here is similar to `StitchMessage`.
-
-
=== Examples
Here are list of examples of data that can be proceeded to Stitch:
@@ -203,8 +176,6 @@ from("direct:sendStitch")
.to("stitch:table_1?token=RAW({{token}})");
--------------------------------------------------------------------------------
-
-
==== Input body type `Iterable`:
[source,java]
--------------------------------------------------------------------------------
diff --git a/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/StitchConstants.java b/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/StitchConstants.java
index f2150ef8427..e434246297c 100644
--- a/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/StitchConstants.java
+++ b/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/StitchConstants.java
@@ -16,15 +16,35 @@
*/
package org.apache.camel.component.stitch;
+import org.apache.camel.spi.Metadata;
+
public final class StitchConstants {
private static final String HEADER_PREFIX = "CamelStitch";
// headers evaluated by producer
+ @Metadata(label = "producer", description = "The name of the destination table the data is being pushed to. " +
+ "Table names must be unique in each destination schema, or loading issues will occur. "
+ +
+ "Note: The number of characters in the table name should be within the destinations allowed limits or data will rejected.",
+ javaType = "String")
public static final String TABLE_NAME = HEADER_PREFIX + "TableName";
+ @Metadata(label = "producer", description = "The schema that describes the Stitch message",
+ javaType = "StitchSchema or Map")
public static final String SCHEMA = HEADER_PREFIX + "Schema";
+ @Metadata(label = "producer",
+ description = "A collection of strings representing the Primary Key fields in the source table. " +
+ "Stitch use these Primary Keys to de-dupe data during loading If not provided, the table will be loaded in an append-only manner.",
+ javaType = "Collection<String>")
public static final String KEY_NAMES = HEADER_PREFIX + "KeyNames";
// headers set by producer
+ @Metadata(label = "producer", description = "HTTP Status code that is returned from Stitch Import HTTP API.",
+ javaType = "Integer")
public static final String CODE = HEADER_PREFIX + "Code";
+ @Metadata(label = "producer", description = "HTTP headers that are returned from Stitch Import HTTP API.",
+ javaType = "Map<String, Object>")
public static final String HEADERS = HEADER_PREFIX + "Headers";
+ @Metadata(label = "producer",
+ description = "The status message that Stitch returns after sending the data through Stitch Import API.",
+ javaType = "String")
public static final String STATUS = HEADER_PREFIX + "Status";
private StitchConstants() {
diff --git a/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/StitchEndpoint.java b/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/StitchEndpoint.java
index 525d89a4556..74a1f748d7a 100644
--- a/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/StitchEndpoint.java
+++ b/components/camel-stitch/src/main/java/org/apache/camel/component/stitch/StitchEndpoint.java
@@ -34,7 +34,8 @@ import org.apache.camel.util.ObjectHelper;
*/
@UriEndpoint(firstVersion = "3.8.0", scheme = "stitch", title = "Stitch",
syntax = "stitch:tableName", producerOnly = true, category = {
- Category.CLOUD, Category.API, Category.COMPUTE, Category.BIGDATA })
+ Category.CLOUD, Category.API, Category.COMPUTE, Category.BIGDATA },
+ headersClass = StitchConstants.class)
public class StitchEndpoint extends DefaultEndpoint {
@UriParam