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 9d7776c417d1274cffceb90f684e7a3e06083d53 Author: Nicolas Filotto <[email protected]> AuthorDate: Tue Apr 5 18:44:08 2022 +0200 CAMEL-17792: Add doc about the message headers of camel-thrift --- .../org/apache/camel/component/thrift/thrift.json | 3 +++ .../camel-thrift/src/main/docs/thrift-component.adoc | 14 +++----------- .../org/apache/camel/component/thrift/ThriftConstants.java | 5 ++++- .../org/apache/camel/component/thrift/ThriftEndpoint.java | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/components/camel-thrift/src/generated/resources/org/apache/camel/component/thrift/thrift.json b/components/camel-thrift/src/generated/resources/org/apache/camel/component/thrift/thrift.json index de2669d2bf1..8037f2bca62 100644 --- a/components/camel-thrift/src/generated/resources/org/apache/camel/component/thrift/thrift.json +++ b/components/camel-thrift/src/generated/resources/org/apache/camel/component/thrift/thrift.json @@ -27,6 +27,9 @@ "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 [...] "useGlobalSslContextParameters": { "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Determine if the thrift component is using global SSL context parameters" } }, + "headers": { + "CamelThriftMethodName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Method name handled by the consumer service" } + }, "properties": { "host": { "kind": "path", "displayName": "Host", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.thrift.ThriftConfiguration", "configurationField": "configuration", "description": "The Thrift server host name. This is localhost or 0.0.0.0 (if not defined) when being a consumer or remote server host name when using producer." }, "port": { "kind": "path", "displayName": "Port", "group": "common", "label": "", "required": true, "type": "integer", "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.thrift.ThriftConfiguration", "configurationField": "configuration", "description": "The Thrift server port" }, diff --git a/components/camel-thrift/src/main/docs/thrift-component.adoc b/components/camel-thrift/src/main/docs/thrift-component.adoc index 16835098636..a1835c1b45e 100644 --- a/components/camel-thrift/src/main/docs/thrift-component.adoc +++ b/components/camel-thrift/src/main/docs/thrift-component.adoc @@ -50,6 +50,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Thrift method parameters mapping @@ -78,17 +81,6 @@ Object responseBody = template.requestBody("direct:thrift-alltypes", requestBody Incoming parameters in the service consumer will also be passed to the message body as a list of objects. - -== Thrift consumer headers (will be installed after the consumer invocation) - -[width="100%",cols="25%,50,25%",options="header",] -|======================================================================= -|Header name |Description|Possible values - -|*CamelThriftMethodName*|Method name handled by the consumer service| - -|======================================================================= - == Examples Below is a simple synchronous method invoke with host and port parameters diff --git a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftConstants.java b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftConstants.java index 2a0bbc8aa1b..4d7a9d62080 100644 --- a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftConstants.java +++ b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftConstants.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.thrift; +import org.apache.camel.spi.Metadata; + /** * Thrift component constants */ @@ -36,7 +38,8 @@ public interface ThriftConstants { int THRIFT_CONSUMER_POOL_SIZE = 1; int THRIFT_CONSUMER_MAX_POOL_SIZE = 10; /* - * This headers will be set after Thrift consumer method is invoked + * This header will be set after Thrift consumer method is invoked */ + @Metadata(label = "consumer", description = "Method name handled by the consumer service", javaType = "String") String THRIFT_METHOD_NAME_HEADER = "CamelThriftMethodName"; } diff --git a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftEndpoint.java b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftEndpoint.java index 330273945e6..a0d23f35b98 100644 --- a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftEndpoint.java +++ b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftEndpoint.java @@ -29,7 +29,7 @@ import org.apache.camel.support.SynchronousDelegateProducer; * Call and expose remote procedures (RPC) with Apache Thrift data format and serialization mechanism. */ @UriEndpoint(firstVersion = "2.20.0", scheme = "thrift", title = "Thrift", syntax = "thrift:host:port/service", - category = { Category.RPC, Category.TRANSFORMATION }) + category = { Category.RPC, Category.TRANSFORMATION }, headersClass = ThriftConstants.class) public class ThriftEndpoint extends DefaultEndpoint { @UriParam private ThriftConfiguration configuration;
