In my application I am trying to subscribe 'MyQueue' queue which has bindings to it in 'Rebus' topic exchange basing on your advices using next code:
async void InitializeBus()
{
var busConfigurer = Configure.With(new CastleWindsorContainerAdapter(_container))
.Logging(l => l.Log4Net())
.Transport(t => t.UseRabbitMq(_connectionString, "MyQueue")
.Declarations(false, false, false)
.ExchangeNames("RebusDirect", "Rebus")
.Prefetch(5))
.Options(o => {
o.SimpleRetryStrategy(_errorQueue);
if (_enableLegacyCompatibility)
{
o.EnableLegacyCompatibility();
}
})
.Serialization(s => s.Decorate(c => new XmlMessageSerializer()));
var bus = busConfigurer.Start();`
await bus.Advanced.Topics.Subscribe("MyQueue");
}
as a result i have an exception like
The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=404, text="NOT_FOUND - no queue 'MyQueue' in vhost '/'", classId=50, methodId=20, cause=
although the queue exists.
If I remove .Declarations(false, false, false) and await bus.Advanced.Topics.Subscribe("MyQueue"); it will create new MyQueue in rabbit in RebusDirect exchange and start listening to it. Connection string to rabbit is correct.
Where the problem could be? Improper configuration or incorrect subscription way?
Thanks in advance.