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 8f95f8b7c7f3b4bd49099b6fff34d82b269ce736 Author: Nicolas Filotto <[email protected]> AuthorDate: Tue Mar 22 15:22:50 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-google-pubsub --- .../apache/camel/component/google/pubsub/google-pubsub.json | 7 +++++++ .../src/main/docs/google-pubsub-component.adoc | 11 +++-------- .../camel/component/google/pubsub/GooglePubsubConstants.java | 11 +++++++++++ .../camel/component/google/pubsub/GooglePubsubEndpoint.java | 3 ++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/components/camel-google/camel-google-pubsub/src/generated/resources/org/apache/camel/component/google/pubsub/google-pubsub.json b/components/camel-google/camel-google-pubsub/src/generated/resources/org/apache/camel/component/google/pubsub/google-pubsub.json index 3762173..4854318 100644 --- a/components/camel-google/camel-google-pubsub/src/generated/resources/org/apache/camel/component/google/pubsub/google-pubsub.json +++ b/components/camel-google/camel-google-pubsub/src/generated/resources/org/apache/camel/component/google/pubsub/google-pubsub.json @@ -33,6 +33,13 @@ "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 [...] "publisherTerminationTimeout": { "kind": "property", "displayName": "Publisher Termination Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "How many milliseconds should a producer be allowed to terminate." } }, + "headers": { + "CamelGooglePubsub.MessageId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ID of the message, assigned by the server when the message is published." }, + "CamelGooglePubsub.MsgAckId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ID used to acknowledge the received message." }, + "CamelGooglePubsub.PublishTime": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "com.google.protobuf.Timestamp", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The time at which the message was published" }, + "CamelGooglePubsub.Attributes": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The attributes of the message." }, + "CamelGooglePubsub.OrderingKey": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "If non-empty, identifies related messages for which publish order should be\n respected." } + }, "properties": { "projectId": { "kind": "path", "displayName": "Project Id", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Google Cloud PubSub Project Id" }, "destinationName": { "kind": "path", "displayName": "Destination Name", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Destination Name. For the consumer this will be the subscription name, while for the producer this will be the topic name." }, diff --git a/components/camel-google/camel-google-pubsub/src/main/docs/google-pubsub-component.adoc b/components/camel-google/camel-google-pubsub/src/main/docs/google-pubsub-component.adoc index 82e06c7..98c993b 100644 --- a/components/camel-google/camel-google-pubsub/src/main/docs/google-pubsub-component.adoc +++ b/components/camel-google/camel-google-pubsub/src/main/docs/google-pubsub-component.adoc @@ -55,6 +55,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Producer Endpoints @@ -93,14 +96,6 @@ To ack/nack the message the component uses Acknowledgement ID stored as header ` If the header is removed or tampered with, the ack will fail and the message will be redelivered again after the ack deadline. -== Message Headers - -Headers set by the consumer endpoints: - -* GooglePubsubConstants.MESSAGE_ID -* GooglePubsubConstants.ATTRIBUTES -* GooglePubsubConstants.PUBLISH_TIME - == Message Body The consumer endpoint returns the content of the message as byte[] - exactly as the underlying system sends it. diff --git a/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConstants.java b/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConstants.java index e44a417..1650293 100644 --- a/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConstants.java +++ b/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConstants.java @@ -16,12 +16,23 @@ */ package org.apache.camel.component.google.pubsub; +import org.apache.camel.spi.Metadata; + public final class GooglePubsubConstants { + @Metadata(description = "The ID of the message, assigned by the server when the message is published.", javaType = "String") public static final String MESSAGE_ID = "CamelGooglePubsub.MessageId"; + @Metadata(label = "consumer", description = "The ID used to acknowledge the received message.", javaType = "String") public static final String ACK_ID = "CamelGooglePubsub.MsgAckId"; + @Metadata(label = "consumer", description = "The time at which the message was published", + javaType = "com.google.protobuf.Timestamp") public static final String PUBLISH_TIME = "CamelGooglePubsub.PublishTime"; + @Metadata(description = "The attributes of the message.", javaType = "Map<String, String>") public static final String ATTRIBUTES = "CamelGooglePubsub.Attributes"; + @Metadata(label = "producer", + description = "If non-empty, identifies related messages for which publish order should be\n" + + " respected.", + javaType = "String") public static final String ORDERING_KEY = "CamelGooglePubsub.OrderingKey"; public static final String RESERVED_GOOGLE_CLIENT_ATTRIBUTE_PREFIX = "goog"; diff --git a/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java b/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java index ade9329..ac8154c 100644 --- a/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java +++ b/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java @@ -41,7 +41,8 @@ import org.slf4j.LoggerFactory; * Built on top of the Google Cloud Pub/Sub libraries. */ @UriEndpoint(firstVersion = "2.19.0", scheme = "google-pubsub", title = "Google Pubsub", - syntax = "google-pubsub:projectId:destinationName", category = { Category.CLOUD, Category.MESSAGING }) + syntax = "google-pubsub:projectId:destinationName", category = { Category.CLOUD, Category.MESSAGING }, + headersClass = GooglePubsubConstants.class) public class GooglePubsubEndpoint extends DefaultEndpoint { private Logger log;
