问题
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