MassTransit AzureServiceBus generated queues

江枫思渺然 提交于 2019-12-11 06:37:46

问题


I have a working configuration for a MT setup that is hosted in an Azure Service Fabric solution.

I have an API that sends messages and a stateless app that reads them.

Inside the stateless app I tell it to consume messages of type TestMessage with the following:

container.Register(Classes.FromThisAssembly().BasedOn<IConsumer>());
var busControl = Bus.Factory.CreateUsingAzureServiceBus(cfg =>
        {
            var h = cfg.Host(new Uri("sb://xxxxx.servicebus.windows.net"), host =>
            {
                host.OperationTimeout = TimeSpan.FromSeconds(5);

                host.TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", "******");
            });

            cfg.ReceiveEndpoint(h, "fabric-test", ec =>
            {
                ec.UseMessageScope<ConsumeContext>();
                ec.LoadFrom(_container);
            });
        });

And in the API I am specifying the fabric-test queue and sending with:

var p = await _bus.GetSendEndpoint(new Uri("sb://xxxxx.servicebus.windows.net/fabric-test"));

await p.Send(new TestMessage(Guid.NewGuid()));

And that all works great - however.

When i look a the azure portal I can see that 3 queues have been created and 1 topic:

  • desktopmmd2jga_stateless1_bus_qypoyyypboqbzhk5bdkg665cyh (queue)
  • desktopmmd2jga_webapi1_bus_qypoyyypboqbsitfbdkg665pdd (queue)
  • fabric-test (queue)
  • xxxxx.core.testmessage (topic)

While it all does work I am wondering what all this is?


回答1:


stateless1 is your service fabric bus instance, the temporary queue created for that bus. webapi1 is your web api bus instance, which is used to send to the stateless service, also a temporary queue. fabric-test is your service queue for your receive endpoint. namespace.core.testmessage is your message type, which is subscribed to by your service endpoint.

This is all built by MassTransit, to support the message structure you're using. The temporary queues disappear after 5 minutes, no worries there - they're just for addressing and maintaining the connection to ASB.

The topic is created in the event a message is published of that type, so that your service endpoint receives it. If you don't want to subscribe topics for message types for a particular service endpoint you can specify SubscribeMessageTopics = false in the configuration for that endpoint.`



来源:https://stackoverflow.com/questions/42901571/masstransit-azureservicebus-generated-queues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!