Skip to content

Commit 6d1e6c4

Browse files
authored
Merge pull request #3799 from mukundansundar/asb-metadata-bindings
add asb metadata based on PR dapr/components-contrib#2203
2 parents ea00e24 + 6b72140 commit 6d1e6c4

File tree

2 files changed

+52
-8
lines changed

2 files changed

+52
-8
lines changed

daprdocs/content/en/reference/components-reference/supported-bindings/servicebusqueues.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
# value: "5"
5757
# - name: publishInitialRetryIntervalInMs # Optional
5858
# value: "500"
59-
# - name: direction
59+
# - name: direction
6060
# value: "input, output"
6161
```
6262
{{% alert title="Warning" color="warning" %}}
@@ -129,6 +129,47 @@ This component supports **output binding** with the following operations:
129129
130130
- `create`: publishes a message to the specified queue
131131

132+
## Message metadata
133+
134+
Azure Service Bus messages extend the Dapr message format with additional contextual metadata. Some metadata fields are set by Azure Service Bus itself (read-only) and others can be set by the client when publishing a message through `Invoke` binding call with `create` operation.
135+
136+
### Sending a message with metadata
137+
138+
To set Azure Service Bus metadata when sending a message, set the query parameters on the HTTP request or the gRPC metadata as documented [here]({{< ref "bindings_api.md" >}}).
139+
140+
- `metadata.MessageId`
141+
- `metadata.CorrelationId`
142+
- `metadata.SessionId`
143+
- `metadata.Label`
144+
- `metadata.ReplyTo`
145+
- `metadata.PartitionKey`
146+
- `metadata.To`
147+
- `metadata.ContentType`
148+
- `metadata.ScheduledEnqueueTimeUtc`
149+
- `metadata.ReplyToSessionId`
150+
151+
{{% alert title="Note" color="primary" %}}
152+
- The `metadata.MessageId` property does not set the `id` property of the cloud event returned by Dapr and should be treated in isolation.
153+
- The `metadata.ScheduledEnqueueTimeUtc` property supports the [RFC1123](https://www.rfc-editor.org/rfc/rfc1123) and [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) timestamp formats.
154+
{{% /alert %}}
155+
156+
### Receiving a message with metadata
157+
158+
When Dapr calls your application, it attaches Azure Service Bus message metadata to the request using either HTTP headers or gRPC metadata.
159+
In addition to the [settable metadata listed above](#sending-a-message-with-metadata), you can also access the following read-only message metadata.
160+
161+
- `metadata.DeliveryCount`
162+
- `metadata.LockedUntilUtc`
163+
- `metadata.LockToken`
164+
- `metadata.EnqueuedTimeUtc`
165+
- `metadata.SequenceNumber`
166+
167+
To find out more details on the purpose of any of these metadata properties, please refer to [the official Azure Service Bus documentation](https://docs.microsoft.com/rest/api/servicebus/message-headers-and-properties#message-headers).
168+
169+
{{% alert title="Note" color="primary" %}}
170+
All times are populated by the server and are not adjusted for clock skews.
171+
{{% /alert %}}
172+
132173
## Specifying a TTL per message
133174

134175
Time to live can be defined on a per-queue level (as illustrated above) or at the message level. The value defined at message level overwrites any value set at the queue level.

daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-servicebus-queues.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ aliases:
1111

1212
To set up Azure Service Bus Queues pub/sub, create a component of type `pubsub.azure.servicebus.queues`. See the [pub/sub broker component file]({{< ref setup-pubsub.md >}}) to learn how ConsumerID is automatically generated. Read the [How-to: Publish and Subscribe guide]({{< ref "howto-publish-subscribe.md#step-1-setup-the-pubsub-component" >}}) on how to create and apply a pub/sub configuration.
1313

14-
> This component uses queues on Azure Service Bus; see the official documentation for the differences between [topics and queues](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-queues-topics-subscriptions).
14+
> This component uses queues on Azure Service Bus; see the official documentation for the differences between [topics and queues](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-queues-topics-subscriptions).
1515
> For using topics, see the [Azure Service Bus Topics pubsub component]({{< ref "setup-azure-servicebus-topics" >}}).
1616
1717
### Connection String Authentication
@@ -122,7 +122,7 @@ Azure Service Bus messages extend the Dapr message format with additional contex
122122
123123
### Sending a message with metadata
124124
125-
To set Azure Service Bus metadata when sending a message, set the query parameters on the HTTP request or the gRPC metadata as documented [here](https://docs.dapr.io/reference/api/pubsub_api/#metadata).
125+
To set Azure Service Bus metadata when sending a message, set the query parameters on the HTTP request or the gRPC metadata as documented [here]({{< ref "pubsub_api.md#metadata" >}}).
126126
127127
- `metadata.MessageId`
128128
- `metadata.CorrelationId`
@@ -135,13 +135,14 @@ To set Azure Service Bus metadata when sending a message, set the query paramete
135135
- `metadata.ScheduledEnqueueTimeUtc`
136136
- `metadata.ReplyToSessionId`
137137

138-
> **Note:** The `metadata.MessageId` property does not set the `id` property of the cloud event returned by Dapr and should be treated in isolation.
139-
140-
> **Note:** The `metadata.ScheduledEnqueueTimeUtc` property supports the [RFC1123](https://www.rfc-editor.org/rfc/rfc1123) and [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) timestamp formats.
138+
{{% alert title="Note" color="primary" %}}
139+
- The `metadata.MessageId` property does not set the `id` property of the cloud event returned by Dapr and should be treated in isolation.
140+
- The `metadata.ScheduledEnqueueTimeUtc` property supports the [RFC1123](https://www.rfc-editor.org/rfc/rfc1123) and [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) timestamp formats.
141+
{{% /alert %}}
141142

142143
### Receiving a message with metadata
143144

144-
When Dapr calls your application, it will attach Azure Service Bus message metadata to the request using either HTTP headers or gRPC metadata.
145+
When Dapr calls your application, it attaches Azure Service Bus message metadata to the request using either HTTP headers or gRPC metadata.
145146
In addition to the [settable metadata listed above](#sending-a-message-with-metadata), you can also access the following read-only message metadata.
146147

147148
- `metadata.DeliveryCount`
@@ -152,7 +153,9 @@ In addition to the [settable metadata listed above](#sending-a-message-with-meta
152153

153154
To find out more details on the purpose of any of these metadata properties, please refer to [the official Azure Service Bus documentation](https://docs.microsoft.com/rest/api/servicebus/message-headers-and-properties#message-headers).
154155

155-
> Note: that all times are populated by the server and are not adjusted for clock skews.
156+
{{% alert title="Note" color="primary" %}}
157+
All times are populated by the server and are not adjusted for clock skews.
158+
{{% /alert %}}
156159

157160
## Sending and receiving multiple messages
158161

0 commit comments

Comments
 (0)