[英]MassTransit with SQS/SNS. Messages not publishing to SQS queues
我正在嘗試使用他們的文檔中提到的公共交通配置將 SNS 主題訂閱到 SQS 隊列。 消息已發布但未出現在 SQS 隊列中。 SQS 隊列名稱:“test”,SNS 主題名稱:“kbbico-manual-to-replace”。
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddMassTransit(x =>
{
/*Configuring a receive endpoint will use the message topology to create and subscribe SNS topics to SQS queues so that
* published messages will be delivered to the receive endpoint queue*/
x.AddConsumer<OfferConsumer>();
x.UsingAmazonSqs((context, cfg) =>
{
cfg.Host("ca-central-1", h =>
{
//h.Config(AmazonSQSConfig);
//h.Config(AmazonSnsConfig);
});
cfg.ReceiveEndpoint("test", e =>
{
e.ConfigureConsumer<OfferConsumer>(context);
// disable the default topic binding
//e.ConfigureConsumeTopology = false;
//Topic subscibed to a recieve endpoint
e.Subscribe("kbbico-manual-to-replace", s =>
{
// set topic attributes
s.TopicAttributes["DisplayName"] = "Public Event Topic";
s.TopicSubscriptionAttributes["some-subscription-attribute"] = "some-attribute-value";
s.TopicTags.Add("environment", "development");
});
});
cfg.ConfigureEndpoints(context);
});
});
services.AddMassTransitHostedService();
}
您沒有配置使用者,因此消息很可能被移動到_skipped隊列(或者可能是 SQS DLQ)。
此外,主機配置中的cfg.ConfigureEndpoints()
根本不屬於那里。 它應該出現在總線配置的最后。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.