Custom metadata not provided to subscriber
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 378
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 6
Description
## Expected Behavior
Custom metadata properties set for a message published using DaprClient are made available to subscribers of this message.
## Actual Behavior
Custom metadata properties are not available from Http headers or otherwise.
## Steps to Reproduce the Problem
- My dapr components are set up with Azure Container Apps, so there may be a limitation I am unaware of
- I am using Asp.net for this for the most part, with `DaprClient` used to publish and `TopicAttribute` to define subscriptions within the controllers.
- Due to some complexity with our application, I use Terraform to actually set up the subscriptions, with `disableEntityManagement` set to true to prevent Dapr setting up the subscriptions itself (perhaps I've missed something key here)
With Azure Service Bus Topics, I can set custom metadata properties using the DaprClient on publish:
```
var metadata = new Dictionary
{
{"cloudevent.type", eventType},
{"eventName", eventName}
};
//@event refers to a class object
await daprClient.PublishEventAsync("pubsubName", "topicName", @event, metadata, ct);
```
I have a controller with endpoints decorated using the TopicAttribute, like below:
```
[HttpPost]
[Route("handle")]
[Topic("pubsubName", "topicName")]
public async Task HandleMessageAsyncJsonDocument @event, [FromHeader(Name="eventName")]string eventName)
{
logger.LogInformation($"EventName: {eventName}");
var context = contextAccessor.HttpContext;
if (context is null)
{
logger.LogInformation($"Could not retrieve HttpContext");
}
else
{
foreach(var header in context.Request.Headers)
{
logger.LogInformation($"Header: {header.Key} - {header.Value}");
}
}
return Result.Error();
}
```
However, whether it's by the FromHeader property or the HttpContext itself, these custom properties, I believe referred to as ApplicationProperties in Azure Service Bus, are not made available.
## Release Note
RELEASE NOTE:
Contributor guide
Assessment
This issue has not been assessed yet.