Description
I'm using the simple consumer example and I get messages from local message broker.
Then I artificially restart the broker.
The frame arrives, gets decoded and the ConnectionClosed exception is created.
However, the code tries to close the connection (and send a CloseOk frame, which won't succeed), but the exceptions are suppressed. The ConnectionClosed itself is passed on, but I don't see where it is raised again.
I'm only getting the following output and no error raised.
Unexpected connection close from remote "amqp://username:******@localhost:5672/%2F", Connection.Close(reply_code=320, reply_text="CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'")
NoneType: None
Note that this is just a print statement, not the exception itself. (I find the NoneType: None
suspiciously buggy). After that, no more messages are consumed.
I'd like to capture the ConnectionClosed (and potientially other related ones) and retry the connection (with an exponential backoff) when the broker is restarted.
Am I miss-using the package or am I missing something in the asyncio-loop catching-exception business?
I've tried to put some encompassing try/except but I can't seem to catch the ConnectionClosed exception (although I see it in the logs, when I turn on the debug output. Where does it get swallowed, and why?)