Dead letter subscription not working with pub sub having consumer ID specified in metadata
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 378
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Description
I use the following declarative subscription.yaml for a Dapr pub/sub component with Dapr version **1.13.2**:
```
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: tenant-notifications-pubsub
spec:
type: pubsub.azure.servicebus
version: v1
metadata:
- name: connectionString # Required
value: "connectionstring"
- name: consumerID
value: "prbuild"
- name: disableEntityManagement
value: "true"
scopes:
- coreservices
```
and the following endpoints:
```
app.MapPost("/core-notifications", ProcessNotificationMessage)
.WithTopic(
new Dapr.TopicOptions()
{
PubsubName = "tenant-notifications-pubsub",
Name = "tenantNotifications",
EnableRawPayload = true,
DeadLetterTopic = "tenant-notifications-deadletter"
}
);
app.MapPost("/failedMessages", ProcessNotificationDeadletter)
.WithTopic(
"tenant-notifications-pubsub",
"tenant-notifications-deadletter"
);
```
## Expected Behavior
Dapr components are to be initialized successfully and any undelivered messages go to the dead-letter topic to be processed and logged.
## Actual Behavior
Received error during Dapr component initialization due to the specified metadata **consumerID** in the pub/sub Dapr component as we have different environments as consumers (with different subscription names, e.g, prbuild, ci, and extdev) to the same messages on the service bus. However, the Dapr log would keep reporting the following error during initialization. Unfortunately we cannot add that subscription to the deadletter topic to the underlying native service bus (in this case Azure Service Bus topic) so not sure how we can get around the problem.
`Starting Dapr with id coreservicesservicev2. HTTP Port: 3500. gRPC Port: 65404
time="2024-05-14T09:54:17.9024596-06:00" level=info msg="starting Dapr Runtime -- version 1.11.2 -- commit 83ca1abb11ffe34211db55dcd36d96b94252827a" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9024848-06:00" level=info msg="log level set to: info" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9030131-06:00" level=info msg="metrics server started on :65405/" app_id=coreservices instance=Q491X382 scope=dapr.metrics type=log ver=1.11.2
time="2024-05-14T09:54:17.907838-06:00" level=info msg="Loading Resiliency configuration: daprCorePubSubResiliency" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.907838-06:00" level=info msg="Resiliency configuration loaded" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9084159-06:00" level=info msg="standalone mode configured" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9084159-06:00" level=info msg="app id: coreservices" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9084159-06:00" level=info msg="mTLS is disabled. Skipping certificate request and tls validation" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9084159-06:00" level=info msg="Dapr trace sampler initialized: DaprTraceSampler(P=1.000000)" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9177658-06:00" level=info msg="local service entry announced: coreservices -> 127.0.0.1:65406" app_id=coreservices component="mdns (nameResolution/v1)" instance=Q491X382 scope=dapr.contrib type=log ver=1.11.2
time="2024-05-14T09:54:17.918767-06:00" level=info msg="Initialized name resolution to mdns" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.918767-06:00" level=info msg="Loading components…" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.921524-06:00" level=info msg="Component loaded: coreservices-pubsub (pubsub.azure.servicebus/v1)" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.921524-06:00" level=info msg="Waiting for all outstanding components to be processed" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.921524-06:00" level=info msg="Component loaded: tenant-notifications-pubsub (pubsub.azure.servicebus/v1)" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9245199-06:00" level=info msg="All outstanding components processed" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9265218-06:00" level=info msg="Loading endpoints" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9305237-06:00" level=info msg="Waiting for all outstanding http endpoints to be processed" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.93252-06:00" level=info msg="All outstanding http endpoints processed" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9345224-06:00" level=info msg="gRPC proxy enabled" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.938215-06:00" level=info msg="gRPC server listening on TCP address: :65404" app_id=coreservices instance=Q491X382 scope=dapr.runtime.grpc.api type=log ver=1.11.2
time="2024-05-14T09:54:17.9408768-06:00" level=info msg="Enabled gRPC tracing middleware" app_id=coreservices instance=Q491X382 scope=dapr.runtime.grpc.api type=log ver=1.11.2
time="2024-05-14T09:54:17.9414443-06:00" level=info msg="Enabled gRPC metrics middleware" app_id=coreservices instance=Q491X382 scope=dapr.runtime.grpc.api type=log ver=1.11.2
time="2024-05-14T09:54:17.9435912-06:00" level=info msg="Registering workflow engine for gRPC endpoint: [::]:65404" app_id=coreservices instance=Q491X382 scope=dapr.runtime.grpc.api type=log ver=1.11.2
time="2024-05-14T09:54:17.9474327-06:00" level=info msg="API gRPC server is running on port 65404" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9528949-06:00" level=info msg="enabled metrics http middleware" app_id=coreservices instance=Q491X382 scope=dapr.runtime.http type=log ver=1.11.2
time="2024-05-14T09:54:17.9534369-06:00" level=info msg="enabled tracing http middleware" app_id=coreservices instance=Q491X382 scope=dapr.runtime.http type=log ver=1.11.2
time="2024-05-14T09:54:17.9539756-06:00" level=info msg="HTTP server listening on TCP address: :3500" app_id=coreservices instance=Q491X382 scope=dapr.runtime.http type=log ver=1.11.2
time="2024-05-14T09:54:17.9545069-06:00" level=info msg="http server is running on port 3500" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9550289-06:00" level=info msg="The request body size parameter is: 4" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9561181-06:00" level=info msg="gRPC server listening on TCP address: :65406" app_id=coreservices instance=Q491X382 scope=dapr.runtime.grpc.internal type=log ver=1.11.2
time="2024-05-14T09:54:17.9561181-06:00" level=info msg="Enabled gRPC tracing middleware" app_id=coreservices instance=Q491X382 scope=dapr.runtime.grpc.internal type=log ver=1.11.2
time="2024-05-14T09:54:17.9572003-06:00" level=info msg="Enabled gRPC metrics middleware" app_id=coreservices instance=Q491X382 scope=dapr.runtime.grpc.internal type=log ver=1.11.2
time="2024-05-14T09:54:17.9577436-06:00" level=info msg="internal gRPC server is running on port 65406" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:17.9582824-06:00" level=info msg="application protocol: http. waiting on port 5000. This will block until the app is listening on that port." app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
Updating metadata for appPID: 31364
Updating metadata for app command: dotnet run --project ..\..\src\CoreServices
You're up and running! Both Dapr and your app logs will appear here.
== APP == Building...
== APP == info: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:5000
== APP == info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down.
== APP == info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development
== APP == info: Microsoft.Hosting.Lifetime[0] Content root path: C:\CoreServices
time="2024-05-14T09:54:29.9453469-06:00" level=info msg="application discovered on port 5000" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:30.0780423-06:00" level=info msg="Application configuration loaded" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:30.0780423-06:00" level=info msg="actors: state store is not configured - this is okay for clients but services with hosted actors will fail to initialize!" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:30.0800448-06:00" level=info msg="actor runtime started. actor idle timeout: 1h0m0s. actor scan interval: 30s" app_id=coreservices instance=Q491X382 scope=dapr.runtime.actor type=log ver=1.11.2
time="2024-05-14T09:54:30.0810417-06:00" level=info msg="Configuring workflow engine with actors backend" app_id=coreservices instance=Q491X382 scope=dapr.runtime.wfengine type=log ver=1.11.2
time="2024-05-14T09:54:30.0810417-06:00" level=info msg="Registering component for dapr workflow engine..." app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:30.0820417-06:00" level=info msg="initializing Dapr workflow component" app_id=coreservices component="dapr (workflow.dapr/v1)" instance=Q491X382 scope=dapr.contrib type=log ver=1.11.2
time="2024-05-14T09:54:30.1569401-06:00" level=info msg="app is subscribed to the following topics: [tenant-notifications tenant-notifications-deadletter] through pubsub=tenant-notifications-pubsub" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:30.1595769-06:00" level=info msg="dapr initialized. Status: Running. Init Elapsed 12251ms" app_id=coreservices instance=Q491X382 scope=dapr.runtime type=log ver=1.11.2
time="2024-05-14T09:54:30.1774118-06:00" level=info msg="placement tables updated, version: 0" app_id=coreservices instance=Q491X382 scope=dapr.runtime.actor.internal.placement type=log ver=1.11.2
time="2024-05-14T09:54:30.8137539-06:00" level=error msg="Error reading from topic tenant-notifications-deadletter. rpc: failed, status code 404 and description: The messaging entity 'sb://extdev-servicebus.servicebus.windows.net/tenant-notifications-deadletter/Subscriptions/prbuild' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:aac5d437-fdca-4d99-815f-879d081837c5_G84, SystemTracker:extdev-servicebus.servicebus.windows.net:tenant-notifications-deadletter/Subscriptions/prbuild, Timestamp:2024-05-14T15:54:31" app_id=coreservices component="tenant-notifications-pubsub (pubsub.azure.servicebus/v1)" instance=Q491X382 scope=dapr.contrib type=log ver=1.11.2
time="2024-05-14T09:54:30.8137762-06:00" level=error msg="rpc: failed, status code 404 and description: The messaging entity 'sb://extdev-servicebus.servicebus.windows.net/tenant-notifications-deadletter/Subscriptions/prbuild' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:aac5d437-fdca-4d99-815f-879d081837c5_G84, SystemTracker:extdev-servicebus.servicebus.windows.net:tenant-notifications-deadletter/Subscriptions/prbuild, Timestamp:2024-05-14T15:54:31" app_id=coreservices component="tenant-notifications-pubsub (pubsub.azure.servicebus/v1)" instance=Q491X382 scope=dapr.contrib type=log ver=1.11.2
time="2024-05-14T09:54:30.8170059-06:00" level=warning msg="Subscription to topic tenant-notifications-deadletter lost connection, attempting to reconnect in 490.526097ms..." app_id=coreservices component="tenant-notifications-pubsub (pubsub.azure.servicebus/v1)" instance=Q491X382 scope=dapr.contrib type=log ver=1.11.2
time="2024-05-14T09:54:32.1257889-06:00" level=error msg="Error reading from topic tenant-notifications-deadletter. rpc: failed, status code 404 and description: The messaging entity 'sb://extdev-servicebus.servicebus.windows.net/tenant-notifications-deadletter/Subscriptions/prbuild' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:dfc26dce-f22e-499b-b8bd-0d87028ffb7e_G84, SystemTracker:extdev-servicebus.servicebus.windows.net:tenant-notifications-deadletter/Subscriptions/prbuild, Timestamp:2024-05-14T15:54:32" app_id=coreservices component="tenant-notifications-pubsub (pubsub.azure.servicebus/v1)" instance=Q491X382 scope=dapr.contrib type=log ver=1.11.2
time="2024-05-14T09:54:32.1257889-06:00" level=error msg="rpc: failed, status code 404 and description: The messaging entity 'sb://extdev-servicebus.servicebus.windows.net/tenant-notifications-deadletter/Subscriptions/prbuild' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:dfc26dce-f22e-499b-b8bd-0d87028ffb7e_G84, SystemTracker:extdev-servicebus.servicebus.windows.net:tenant-notifications-deadletter/Subscriptions/prbuild, Timestamp:2024-05-14T15:54:32" app_id=coreservices component="tenant-notifications-pubsub (pubsub.azure.servicebus/v1)" instance=Q491X382 scope=dapr.contrib type=log ver=1.11.2
time="2024-05-14T09:54:32.1280111-06:00" level=warning msg="Subscription to topic tenant-notifications-deadletter lost connection, attempting to reconnect in 683.210305ms..." app_id=coreservices component="tenant-notifications-pubsub (pubsub.azure.servicebus/v1)" instance=Q491X382 scope=dapr.contrib type=log ver=1.11.2
`
## Steps to Reproduce the Problem
Anytime you specify **ConsumerID** in the metadata for the Dapr pub/sub component, you would not be able to specify deadletter topic and create subscription to the deadletter topic.
## Release Note
RELEASE NOTE:
Contributor guide
Assessment
This issue has not been assessed yet.