繁体   English   中英

带有 SQS/SNS 的公共交通。 消息未发布到 SQS 队列

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM