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 174a13f77d45723db11b7f576ea8fc816c49620d Author: Nicolas Filotto <[email protected]> AuthorDate: Wed Mar 16 16:43:22 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-azure-servicebus --- .../azure/servicebus/azure-servicebus.json | 27 +++++++++++++ .../src/main/docs/azure-servicebus-component.adoc | 44 ++------------------ .../azure/servicebus/ServiceBusConstants.java | 47 ++++++++++++++++++++++ .../azure/servicebus/ServiceBusEndpoint.java | 3 +- 4 files changed, 79 insertions(+), 42 deletions(-) diff --git a/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json b/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json index f36b10e..a88210a 100644 --- a/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json +++ b/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json @@ -48,6 +48,33 @@ "fullyQualifiedNamespace": { "kind": "property", "displayName": "Fully Qualified Namespace", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Fully Qualified Namespace of the service bus" }, "tokenCredential": { "kind": "property", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication, implemented in com.azure [...] }, + "headers": { + "CamelAzureServiceBusApplicationProperties": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the set of free-form `ServiceBusReceivedMessage` properties which may be used for passing metadata associated with the `ServiceBusReceivedMessagel during Service Bus operations." }, + "CamelAzureServiceBusContentType": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the content type of the message." }, + "CamelAzureServiceBusCorrelationId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets a correlation identifier." }, + "CamelAzureServiceBusDeadLetterErrorDescription": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the description for a message that has been dead-lettered." }, + "CamelAzureServiceBusDeadLetterReason": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the reason a message was dead-lettered." }, + "CamelAzureServiceBusDeadLetterSource": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the name of the queue or subscription that this message was enqueued on, before it was dead-lettered." }, + "CamelAzureServiceBusDeliveryCount": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the number of the times this message was delivered to clients." }, + "CamelAzureServiceBusEnqueuedSequenceNumber": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the enqueued sequence number assigned to a message by Service Bus." }, + "CamelAzureServiceBusEnqueuedTime": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "OffsetDateTime", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the datetime at which this message was enqueued in Azure Service Bus." }, + "CamelAzureServiceBusExpiresAt": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "OffsetDateTime", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the datetime at which this message will expire." }, + "CamelAzureServiceBusLockToken": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the lock token for the current message." }, + "CamelAzureServiceBusLockedUntil": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "OffsetDateTime", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the datetime at which the lock of this message expires." }, + "CamelAzureServiceBusMessageId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the identifier for the message." }, + "CamelAzureServiceBusPartitionKey": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the partition key for sending a message to a partitioned entity." }, + "CamelAzureServiceBusRawAmqpMessage": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "AmqpAnnotatedMessage", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The representation of message as defined by AMQP protocol." }, + "CamelAzureServiceBusReplyTo": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the address of an entity to send replies to." }, + "CamelAzureServiceBusReplyToSessionId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets or sets a session identifier augmenting the ReplyTo address." }, + "CamelAzureServiceBusSequenceNumber": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the unique number assigned to a message by Service Bus." }, + "CamelAzureServiceBusSessionId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the session id of the message." }, + "CamelAzureServiceBusSubject": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the subject for the message." }, + "CamelAzureServiceBusTimeToLive": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Duration", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the duration before this message expires." }, + "CamelAzureServiceBusTo": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Gets the \"to\" address." }, + "CamelAzureServiceBusScheduledEnqueueTime": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "OffsetDateTime", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "(producer)Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. (consumer) Gets the scheduled enqueue time of this message." }, + "CamelAzureServiceBusServiceBusTransactionContext": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "ServiceBusTransactionContext", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Overrides the transaction in service. This object just contains transaction id." }, + "CamelAzureServiceBusProducerOperation": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Overrides the desired operation to be used in the producer." } + }, "properties": { "topicOrQueueName": { "kind": "path", "displayName": "Topic Or Queue Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Selected topic name or the queue name, that is depending on serviceBusType config. For example if service [...] "amqpRetryOptions": { "kind": "parameter", "displayName": "Amqp Retry Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.AmqpRetryOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the retry options for Service Bus clients. If not specified, the defau [...] diff --git a/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc b/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc index f82c6f2..c5e83d5 100644 --- a/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc +++ b/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc @@ -56,47 +56,9 @@ This allows camel route to consume and produce events asynchronously without blo == Usage -=== Message headers evaluated by the component producer -[width="100%",cols="10%,10%,10%,70%",options="header",] -|======================================================================= -|Header |Variable Name |Type |Description - -|`CamelAzureServiceBusScheduledEnqueueTime`| `ServiceBusConstants.SCHEDULED_ENQUEUE_TIME`|`OffsetDateTime`| Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. -|`CamelAzureServiceBusServiceBusTransactionContext`| `ServiceBusConstants.SERVICE_BUS_TRANSACTION_CONTEXT`|`ServiceBusTransactionContext`| Overrides the transaction in service. This object just contains transaction id. -|`CamelAzureServiceBusProducerOperation`| `ServiceBusConstants.PRODUCER_OPERATION`|`ServiceBusProducerOperationDefinition`| Overrides the desired operation to be used in the producer. -|======================================================================= - - -=== Message headers set by the component consumer -[width="100%",cols="10%,10%,10%,70%",options="header",] -|======================================================================= -|Header |Variable Name |Type |Description - -|`CamelAzureServiceBusApplicationProperties`| `ServiceBusConstants.APPLICATION_PROPERTIES`|`Map<String, Object>`| Gets the set of free-form {@link ServiceBusReceivedMessage} properties which may be used for passing metadata associated with the {@link ServiceBusReceivedMessage} during Service Bus operations. -|`CamelAzureServiceBusContentType`| `ServiceBusConstants.CONTENT_TYPE`|`String`| Gets the content type of the message. -|`CamelAzureServiceBusMessageId`| `ServiceBusConstants.MESSAGE_ID`|`String`| Gets the identifier for the message. -|`CamelAzureServiceBusCorrelationId`| `ServiceBusConstants.CORRELATION_ID`|`String`| Gets a correlation identifier. -|`CamelAzureServiceBusDeadLetterErrorDescription`| `ServiceBusConstants.DEAD_LETTER_ERROR_DESCRIPTION`|`String`| Gets the description for a message that has been dead-lettered. -|`CamelAzureServiceBusDeadLetterReason`| `ServiceBusConstants.DEAD_LETTER_REASON`|`String`| Gets the reason a message was dead-lettered. -|`CamelAzureServiceBusDeadLetterSource`| `ServiceBusConstants.DEAD_LETTER_SOURCE`|`String`| Gets the name of the queue or subscription that this message was enqueued on, before it was dead-lettered. -|`CamelAzureServiceBusDeliveryCount`| `ServiceBusConstants.DELIVERY_COUNT`|`long`| Gets the number of the times this message was delivered to clients. -|`CamelAzureServiceBusScheduledEnqueueTime`| `ServiceBusConstants.SCHEDULED_ENQUEUE_TIME`|`OffsetDateTime`| Gets the scheduled enqueue time of this message. -|`CamelAzureServiceBusEnqueuedSequenceNumber`| `ServiceBusConstants.ENQUEUED_SEQUENCE_NUMBER`|`long`| Gets the enqueued sequence number assigned to a message by Service Bus. -|`CamelAzureServiceBusEnqueuedTime`| `ServiceBusConstants.ENQUEUED_TIME`|`OffsetDateTime`| Gets the datetime at which this message was enqueued in Azure Service Bus. -|`CamelAzureServiceBusExpiresAt`| `ServiceBusConstants.EXPIRES_AT`|`OffsetDateTime`| Gets the datetime at which this message will expire. -|`CamelAzureServiceBusLockToken`| `ServiceBusConstants.LOCK_TOKEN`|`String`| Gets the lock token for the current message. -|`CamelAzureServiceBusLockedUntil`| `ServiceBusConstants.LOCKED_UNTIL`|`OffsetDateTime`| Gets the datetime at which the lock of this message expires. -|`CamelAzureServiceBusPartitionKey`| `ServiceBusConstants.PARTITION_KEY`|`String`| Gets the partition key for sending a message to a partitioned entity. -|`CamelAzureServiceBusRawAmqpMessage`| `ServiceBusConstants.RAW_AMQP_MESSAGE`|`AmqpAnnotatedMessage`| The representation of message as defined by AMQP protocol. -|`CamelAzureServiceBusReplyTo`| `ServiceBusConstants.REPLY_TO`|`String`| Gets the address of an entity to send replies to. -|`CamelAzureServiceBusReplyToSessionId`| `ServiceBusConstants.REPLY_TO_SESSION_ID`|`String`| Gets or sets a session identifier augmenting the {@link #getReplyTo() ReplyTo} address. -|`CamelAzureServiceBusSequenceNumber`| `ServiceBusConstants.SEQUENCE_NUMBER`|`long`| Gets the unique number assigned to a message by Service Bus. -|`CamelAzureServiceBusSessionId`| `ServiceBusConstants.SESSION_ID`|`String`| Gets the session id of the message. -|`CamelAzureServiceBusSubject`| `ServiceBusConstants.SUBJECT`|`String`| Gets the subject for the message. -|`CamelAzureServiceBusTimeToLive`| `ServiceBusConstants.TIME_TO_LIVE`|`Duration`| Gets the duration before this message expires. -|`CamelAzureServiceBusTimeTo`| `ServiceBusConstants.TO`|`String`| Gets the "to" address. -|======================================================================= - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END === Message Body In the producer, this component accepts message body of `String` type or `List<String>` to send batch messages. diff --git a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConstants.java b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConstants.java index 0e98675..832fe2a 100644 --- a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConstants.java +++ b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConstants.java @@ -16,39 +16,86 @@ */ package org.apache.camel.component.azure.servicebus; +import org.apache.camel.spi.Metadata; + public final class ServiceBusConstants { private static final String HEADER_PREFIX = "CamelAzureServiceBus"; // common headers, set by consumer and evaluated by producer // headers set by the consumer only + @Metadata(label = "consumer", + description = "Gets the set of free-form `ServiceBusReceivedMessage` properties which may be used for passing metadata associated with the `ServiceBusReceivedMessagel during Service Bus operations.", + javaType = "Map<String, Object>") public static final String APPLICATION_PROPERTIES = HEADER_PREFIX + "ApplicationProperties"; + @Metadata(label = "consumer", description = "Gets the content type of the message.", javaType = "String") public static final String CONTENT_TYPE = HEADER_PREFIX + "ContentType"; + @Metadata(label = "consumer", description = "Gets a correlation identifier.", javaType = "String") public static final String CORRELATION_ID = HEADER_PREFIX + "CorrelationId"; + @Metadata(label = "consumer", description = "Gets the description for a message that has been dead-lettered.", + javaType = "String") public static final String DEAD_LETTER_ERROR_DESCRIPTION = HEADER_PREFIX + "DeadLetterErrorDescription"; + @Metadata(label = "consumer", description = "Gets the reason a message was dead-lettered.", javaType = "String") public static final String DEAD_LETTER_REASON = HEADER_PREFIX + "DeadLetterReason"; + @Metadata(label = "consumer", + description = "Gets the name of the queue or subscription that this message was enqueued on, before it was dead-lettered.", + javaType = "String") public static final String DEAD_LETTER_SOURCE = HEADER_PREFIX + "DeadLetterSource"; + @Metadata(label = "consumer", description = "Gets the number of the times this message was delivered to clients.", + javaType = "long") public static final String DELIVERY_COUNT = HEADER_PREFIX + "DeliveryCount"; + @Metadata(label = "consumer", description = "Gets the enqueued sequence number assigned to a message by Service Bus.", + javaType = "long") public static final String ENQUEUED_SEQUENCE_NUMBER = HEADER_PREFIX + "EnqueuedSequenceNumber"; + @Metadata(label = "consumer", description = "Gets the datetime at which this message was enqueued in Azure Service Bus.", + javaType = "OffsetDateTime") public static final String ENQUEUED_TIME = HEADER_PREFIX + "EnqueuedTime"; + @Metadata(label = "consumer", description = "Gets the datetime at which this message will expire.", + javaType = "OffsetDateTime") public static final String EXPIRES_AT = HEADER_PREFIX + "ExpiresAt"; + @Metadata(label = "consumer", description = "Gets the lock token for the current message.", javaType = "String") public static final String LOCK_TOKEN = HEADER_PREFIX + "LockToken"; + @Metadata(label = "consumer", description = "Gets the datetime at which the lock of this message expires.", + javaType = "OffsetDateTime") public static final String LOCKED_UNTIL = HEADER_PREFIX + "LockedUntil"; + @Metadata(label = "consumer", description = "Gets the identifier for the message.", javaType = "String") public static final String MESSAGE_ID = HEADER_PREFIX + "MessageId"; + @Metadata(label = "consumer", description = "Gets the partition key for sending a message to a partitioned entity.", + javaType = "String") public static final String PARTITION_KEY = HEADER_PREFIX + "PartitionKey"; + @Metadata(label = "consumer", description = "The representation of message as defined by AMQP protocol.", + javaType = "AmqpAnnotatedMessage") public static final String RAW_AMQP_MESSAGE = HEADER_PREFIX + "RawAmqpMessage"; + @Metadata(label = "consumer", description = "Gets the address of an entity to send replies to.", javaType = "String") public static final String REPLY_TO = HEADER_PREFIX + "ReplyTo"; + @Metadata(label = "consumer", description = "Gets or sets a session identifier augmenting the ReplyTo address.", + javaType = "String") public static final String REPLY_TO_SESSION_ID = HEADER_PREFIX + "ReplyToSessionId"; + @Metadata(label = "consumer", description = "Gets the unique number assigned to a message by Service Bus.", + javaType = "long") public static final String SEQUENCE_NUMBER = HEADER_PREFIX + "SequenceNumber"; + @Metadata(label = "consumer", description = "Gets the session id of the message.", javaType = "String") public static final String SESSION_ID = HEADER_PREFIX + "SessionId"; + @Metadata(label = "consumer", description = "Gets the subject for the message.", javaType = "String") public static final String SUBJECT = HEADER_PREFIX + "Subject"; + @Metadata(label = "consumer", description = "Gets the duration before this message expires.", javaType = "Duration") public static final String TIME_TO_LIVE = HEADER_PREFIX + "TimeToLive"; + @Metadata(label = "consumer", description = "Gets the \"to\" address.", javaType = "String") public static final String TO = HEADER_PREFIX + "To"; // headers set by consumer and evaluated by producer + @Metadata(description = "(producer)Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. " + + + "(consumer) Gets the scheduled enqueue time of this message.", + javaType = "OffsetDateTime") public static final String SCHEDULED_ENQUEUE_TIME = HEADER_PREFIX + "ScheduledEnqueueTime"; // headers evaluated by the producer + @Metadata(label = "producer", + description = "Overrides the transaction in service. This object just contains transaction id.", + javaType = "ServiceBusTransactionContext") public static final String SERVICE_BUS_TRANSACTION_CONTEXT = HEADER_PREFIX + "ServiceBusTransactionContext"; + @Metadata(label = "producer", description = "Overrides the desired operation to be used in the producer.", + javaType = "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition") public static final String PRODUCER_OPERATION = HEADER_PREFIX + "ProducerOperation"; private ServiceBusConstants() { diff --git a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpoint.java b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpoint.java index 45ad355..043f78a 100644 --- a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpoint.java +++ b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpoint.java @@ -30,7 +30,8 @@ import org.apache.camel.support.DefaultEndpoint; */ @UriEndpoint(firstVersion = "3.12.0", scheme = "azure-servicebus", title = "Azure ServiceBus", syntax = "azure-servicebus:topicOrQueueName", category = { - Category.CLOUD, Category.MESSAGING }) + Category.CLOUD, Category.MESSAGING }, + headersClass = ServiceBusConstants.class) public class ServiceBusEndpoint extends DefaultEndpoint { @UriParam
