Skip to content

Commit 9c523cf

Browse files
authored
Merge pull request #4495 from elKei24/patch-1
Add section about custom properties to setup-azure-eventhub.md
2 parents 82e175c + ab94590 commit 9c523cf

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

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

+38
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,44 @@ Entity management is only possible when using [Microsoft Entra ID Authentication
195195

196196
> Dapr passes the name of the consumer group to the Event Hub, so this is not supplied in the metadata.
197197

198+
## Receiving custom properties
199+
200+
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.
201+
202+
```yaml
203+
apiVersion: dapr.io/v2alpha1
204+
kind: Subscription
205+
metadata:
206+
name: order-pub-sub
207+
spec:
208+
topic: orders
209+
routes:
210+
default: /checkout
211+
pubsubname: order-pub-sub
212+
metadata:
213+
requireAllProperties: "true"
214+
```
215+
216+
The same can be achieved using the Dapr SDK:
217+
218+
{{< tabs ".NET" >}}
219+
220+
{{% codetab %}}
221+
222+
```csharp
223+
[Topic("order-pub-sub", "orders")]
224+
[TopicMetadata("requireAllProperties", "true")]
225+
[HttpPost("checkout")]
226+
public ActionResult Checkout(Order order, [FromHeader] int priority)
227+
{
228+
return Ok();
229+
}
230+
```
231+
232+
{{% /codetab %}}
233+
234+
{{< /tabs >}}
235+
198236
## Subscribing to Azure IoT Hub Events
199237

200238
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.

0 commit comments

Comments
 (0)