From 257c47d11358c6b627d8c1de7a51f0cc13854510 Mon Sep 17 00:00:00 2001 From: Elias Keis <13063245+elKei24@users.noreply.github.com> Date: Mon, 20 Jan 2025 15:26:37 +0100 Subject: [PATCH 1/2] Add section about custom properties Signed-off-by: Elias Keis <13063245+elKei24@users.noreply.github.com> --- .../supported-pubsub/setup-azure-eventhubs.md | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-eventhubs.md b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-eventhubs.md index 713bdb1cbb7..bd4a881edee 100644 --- a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-eventhubs.md +++ b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-eventhubs.md @@ -195,6 +195,44 @@ Entity management is only possible when using [Microsoft Entra ID Authentication > Dapr passes the name of the consumer group to the Event Hub, so this is not supplied in the metadata. +## Receiving custom properties + +By default, Dapr does not forward [custom properties](https://learn.microsoft.com/en-us/azure/event-hubs/add-custom-data-event). However, by setting the subscription metadata `requireAllProperties` to `"true"`, you can receive custom properties as HTTP headers. + +```yaml +apiVersion: dapr.io/v2alpha1 +kind: Subscription +metadata: + name: order-pub-sub +spec: + topic: orders + routes: + default: /checkout + pubsubname: order-pub-sub + metadata: + requireAllProperties: "true" +``` + +The same can be achieved using the Dapr SDK: + +{{< tabs ".NET" >}} + +{{% codetab %}} + +```csharp +[Topic("order-pub-sub", "orders")] +[TopicMetadata("requireAllProperties", "true")] +[HttpPost("checkout")] +public ActionResult Checkout(Order order, [FromHeader] int priority) +{ + return Ok(); +} +``` + +{{% /codetab %}} + +{{< /tabs >}} + ## Subscribing to Azure IoT Hub Events Azure IoT Hub provides an [endpoint that is compatible with Event Hubs](https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messages-read-builtin#read-from-the-built-in-endpoint), so the Azure Event Hubs pubsub component can also be used to subscribe to Azure IoT Hub events. From ab94590ea9a0d80ff4154f43e6d148f41d9f3359 Mon Sep 17 00:00:00 2001 From: Elias Keis <13063245+elKei24@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:58:59 +0100 Subject: [PATCH 2/2] remove url localization (suggestion from code review) Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Elias Keis <13063245+elKei24@users.noreply.github.com> --- .../supported-pubsub/setup-azure-eventhubs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-eventhubs.md b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-eventhubs.md index bd4a881edee..f778c3824b6 100644 --- a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-eventhubs.md +++ b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-azure-eventhubs.md @@ -197,7 +197,7 @@ Entity management is only possible when using [Microsoft Entra ID Authentication ## Receiving custom properties -By default, Dapr does not forward [custom properties](https://learn.microsoft.com/en-us/azure/event-hubs/add-custom-data-event). However, by setting the subscription metadata `requireAllProperties` to `"true"`, you can receive custom properties as HTTP headers. +By default, Dapr does not forward [custom properties](https://learn.microsoft.com/azure/event-hubs/add-custom-data-event). However, by setting the subscription metadata `requireAllProperties` to `"true"`, you can receive custom properties as HTTP headers. ```yaml apiVersion: dapr.io/v2alpha1