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/22 16:52:03 UTC
[camel] 14/14: CAMEL-17792: Add doc about the message headers of camel-grpc
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 d65d2d8bda9b8682dc5004b6a01707f3914c3595
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Mar 22 17:08:29 2022 +0100
CAMEL-17792: Add doc about the message headers of camel-grpc
---
components/camel-grpc/pom.xml | 13 +++++++++++++
.../resources/org/apache/camel/component/grpc/grpc.json | 5 +++++
components/camel-grpc/src/main/docs/grpc-component.adoc | 16 +++-------------
.../org/apache/camel/component/grpc/GrpcConstants.java | 11 +++++++++++
.../org/apache/camel/component/grpc/GrpcEndpoint.java | 2 +-
5 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/components/camel-grpc/pom.xml b/components/camel-grpc/pom.xml
index 802a1574..0d1c040 100644
--- a/components/camel-grpc/pom.xml
+++ b/components/camel-grpc/pom.xml
@@ -265,6 +265,19 @@
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
+ <!-- Force the version of guava to camel-package-maven-plugin to prevent build failure due to the
+ usage of an old/incompatible version of guava -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-package-maven-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${google-guava-version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/components/camel-grpc/src/generated/resources/org/apache/camel/component/grpc/grpc.json b/components/camel-grpc/src/generated/resources/org/apache/camel/component/grpc/grpc.json
index 0093a0b..03d0334 100644
--- a/components/camel-grpc/src/generated/resources/org/apache/camel/component/grpc/grpc.json
+++ b/components/camel-grpc/src/generated/resources/org/apache/camel/component/grpc/grpc.json
@@ -26,6 +26,11 @@
"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": {
+ "CamelGrpcMethodName": { "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" },
+ "CamelGrpcUserAgent": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "If provided, the given agent will prepend the gRPC library's user agent information" },
+ "CamelGrpcEventType": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Received event type from the sent request.\n\nPossible values:\n\n* onNext\n* onCompleted\n* onError" }
+ },
"properties": {
"host": { "kind": "path", "displayName": "Host", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.grpc.GrpcConfiguration", "configurationField": "configuration", "description": "The gRPC server host name. This is localhost or 0.0.0.0 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.grpc.GrpcConfiguration", "configurationField": "configuration", "description": "The gRPC local or remote server port" },
diff --git a/components/camel-grpc/src/main/docs/grpc-component.adoc b/components/camel-grpc/src/main/docs/grpc-component.adoc
index b0b1ab5..ad0177b 100644
--- a/components/camel-grpc/src/main/docs/grpc-component.adoc
+++ b/components/camel-grpc/src/main/docs/grpc-component.adoc
@@ -59,7 +59,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
== Transport security and authentication support
@@ -114,18 +116,6 @@ The table below shows the types of objects in the message body, depending on the
|=======================================================================
-== gRPC consumer headers (will be installed after the consumer invocation)
-
-[width="100%",cols="25%,50,25%",options="header",]
-|=======================================================================
-|Header name |Description|Possible values
-
-|*CamelGrpcMethodName*|Method name handled by the consumer service|
-|*CamelGrpcEventType*|Received event type from the sent request|onNext, onCompleted or onError
-|*CamelGrpcUserAgent*|If provided, the given agent will prepend the gRPC library's user agent information|
-
-|=======================================================================
-
== Examples
Below is a simple synchronous method invoke with host and port parameters
diff --git a/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcConstants.java b/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcConstants.java
index 106813b..8aae089 100644
--- a/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcConstants.java
+++ b/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcConstants.java
@@ -43,8 +43,19 @@ public interface GrpcConstants {
/*
* This headers will be set after gRPC consumer method is invoked
*/
+ @org.apache.camel.spi.Metadata(label = "consumer", description = "Method name handled by the consumer service",
+ javaType = "String")
String GRPC_METHOD_NAME_HEADER = "CamelGrpcMethodName";
+ @org.apache.camel.spi.Metadata(label = "consumer",
+ description = "If provided, the given agent will prepend the gRPC library's user agent information",
+ javaType = "String")
String GRPC_USER_AGENT_HEADER = "CamelGrpcUserAgent";
+ @org.apache.camel.spi.Metadata(label = "consumer", description = "Received event type from the sent request.\n\n" +
+ "Possible values:\n\n" +
+ "* onNext\n" +
+ "* onCompleted\n" +
+ "* onError",
+ javaType = "String")
String GRPC_EVENT_TYPE_HEADER = "CamelGrpcEventType";
String GRPC_EVENT_TYPE_ON_NEXT = "onNext";
diff --git a/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcEndpoint.java b/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcEndpoint.java
index c3dd36e..e293f0b 100644
--- a/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcEndpoint.java
+++ b/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcEndpoint.java
@@ -30,7 +30,7 @@ import org.apache.camel.util.ObjectHelper;
* Expose gRPC endpoints and access external gRPC endpoints.
*/
@UriEndpoint(firstVersion = "2.19.0", scheme = "grpc", title = "gRPC", syntax = "grpc:host:port/service",
- category = { Category.RPC })
+ category = { Category.RPC }, headersClass = GrpcConstants.class)
public class GrpcEndpoint extends DefaultEndpoint {
@UriParam
protected final GrpcConfiguration configuration;