azureservicebusdapr

Dapr pubsub consumer is not consuming messages


I've got pubsub with Redis working locally. I can deploy to Azure and see messages being created in the topic subscription.

If I query /dapr/subscribe I get [{"topic":"TestGotUser","pubsubName":"pubsub","route":"PubSubEventGotUserSubscriber"}] so it's wired as expected. My problem is the consumer is silently just not retrieving messages

app.MapPost("/PubSubEventGotUserSubscriber", async (DaprTestApis handler, MessageEvent item) =>
{
  await handler.PubSubEventGotUserSubscriber(item);
}).WithTopic("pubsub", "TestGotUser";

// and handler
public async Task PubSubEventGotUserSubscriber(MessageEvent item)
{           
  _logger.LogInformation($"Received Message: User is {item.Message}");
  await Task.CompletedTask;
}

the endpoint is never hit.

I'm using Managed Identities and the mi has "Azure Service Bus Data Receiver " and "Azure Service Bus Data Sender "

What could I be missing? I guess something in Azure. I am totally stuck


Solution

  • The managed identity also creates topics and subscriptions, so needs more than 'Data Sender'.

    We went with 'Azure Service Bus Data Owner' (in dev) but this should really be more fine grained in production ('Create or Update Topic' etc.)