pardahlman / RawRabbit

A modern .NET framework for communication over RabbitMq
MIT License
747 stars 144 forks source link

Failure Recovery #142

Closed cocowalla closed 8 years ago

cocowalla commented 8 years ago

What I'm aiming for is request, respond, publish and subscribe all to be fault tolerant - that is, if the broker goes down, they should keep trying to reconnect until it comes back up. I have both AutomaticRecovery and TopologyRecovery enabled in my RawRabbitConfiguration.

My clients are using Polly, so that if there is a broker-related exception, they should backoff for a time and then try again.

However, if the broker goes down and then comes back up, it looks like RawRabbit's reconnection attempt is failing:

[ThreadBasedChannelFactory]: Channel '1' is recovered. Adding it to pool.
Topology recovery exception: RabbitMQ.Client.TopologyRecoveryException:
Caught an exception while recovering exchange my_exchange:
Already closed: The AMQP operation was interrupted:
AMQP close-reason, initiated by Application, code=200, text="Goodbye", classId=0, methodId=0, cause= ---> 
RabbitMQ.Client.Exceptions.AlreadyClosedException: Already closed: The AMQP operation was interrupted:
AMQP close-reason, initiated by Application, code=200, text="Goodbye", classId=0, methodId=0, cause=
    at RabbitMQ.Client.Impl.SessionBase.Transmit(Command cmd)
    at RabbitMQ.Client.Impl.ModelBase.ModelRpc(MethodBase method, ContentHeaderBase header, Byte[] body)
    at RabbitMQ.Client.Framing.Impl.Model._Private_ExchangeDeclare(String exchange, String type, Boolean passive, Boolean durable, Boolean autoDelete, Boolean internal, Boolean nowait, IDictionary`2 arguments)
    at RabbitMQ.Client.Impl.ModelBase.ExchangeDeclare(String exchange, String type, Boolean durable, Boolean autoDelete, IDictionary`2 arguments)
    at RabbitMQ.Client.Impl.RecordedExchange.Recover()
    at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.RecoverExchanges()
    --- End of inner exception stack trace ---

Am I perhaps missing something in my configuration?

cocowalla commented 8 years ago

Ah, I;ve just seen this - so this is an issue with the RabbitMQ client, not RawRabbit. Furthermore, everything does appear to be recovering OK, despite the error message.