Вопрос

I'm having trouble at the moment with running multiple environments simultaneously with easynetq

When I publish a message on my dev environment the message is also picked up in my staging and acceptance environments.

The way around this is to create an exchange per environment using the advanced bus with something like

string exchangeName = String.Format("MyProject_{0}", environmentName);
return advancedBus.ExchangeDeclare(exchangeName, ExchangeType.Direct);

However I now can't figure out how to make this the default exchange that will be used if I resolve an IBus interface.

Can this be done or do I have to go down the route of only using the IAdvancedBus?

Это было полезно?

Решение

You really shouldn't share the same RabbitMQ virtual host between different environments. It's like expecting a single SQL database to handle dev, test and live.

Have different configurations for each environment maintained in environment specific App(Web).config files (or use some kind of tokenisation). Each config should maintain a unique EasyNetQ connection string. You can have them all use the same broker, but have them connect to different virtual hosts.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top