Dapr pubsub消费者未消费消息。

huangapple go评论38阅读模式
英文:

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.

英文:

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

答案1

得分: 0

The managed identity also creates topics and subscriptions, so needs more than 'Data Sender'.
我们的托管身份还创建主题和订阅,因此需要更多权限而不仅仅是“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.).
我们选择了“Azure Service Bus Data Owner”(在开发中),但在生产环境中,这应该更加精细化(例如,“创建或更新主题”等)。

英文:

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

huangapple
  • 本文由 发表于 2023年5月17日 22:09:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76273038.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定