如何从masstransit服务总线配置创建虚拟主机?
我的意思是,例如,我将我的应用程序部署到一台新PC上,它应该为自己创建新的虚拟主机。
我尝试这样做:
var bus = ServiceBusFactory.New(sbc =>
{
sbc.UseRabbitMq();
sbc.UseHealthMonitoring(10);
sbc.ReceiveFrom("rabbitmq://localhost:5672/mynewcustomvhost/myqueue?temporary=true");
});
但是得到错误:
"No Obvious Problems says ConfigurationResult"
为什么会这样?
答案 0 :(得分:0)
试试这个:
ServiceBusFactory.New(sbc =>
{
sbc.UseRabbitMq(r =>
{
r.ConfigureHost(new Uri("rabbitmq://hostname/vhost/queue"), h =>
{
h.SetUsername("username");
h.SetPassword("password");
});
});
// other options
});