RabbitMQ. Masstransit. Virtual Hosts.

天大地大妈咪最大 提交于 2019-12-25 09:42:25

问题


how can I create virtual host from masstransit service bus configuration?

I mean, for example, I deployed my app to some new PC and it should create new virtual host for itself.

I'm trying do this like this:

var bus = ServiceBusFactory.New(sbc =>
            {
                sbc.UseRabbitMq();
                sbc.UseHealthMonitoring(10);
                sbc.ReceiveFrom("rabbitmq://localhost:5672/mynewcustomvhost/myqueue?temporary=true");
            });

But getting error:

"No Obvious Problems says ConfigurationResult"

Why so?


回答1:


Try this:

ServiceBusFactory.New(sbc =>
{
  sbc.UseRabbitMq(r =>
                  {
                      r.ConfigureHost(new Uri("rabbitmq://hostname/vhost/queue"), h =>
                      {
                          h.SetUsername("username");
                          h.SetPassword("password");
                      });
                  });

  // other options
});


来源:https://stackoverflow.com/questions/27092932/rabbitmq-masstransit-virtual-hosts

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