make skip IncompatibleProtocolError as optional for client to adapt scenarios like ELB connection #516
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In my scenario with configurations
when some of rabbitMQ is down and the cluster is not in function, tornado's pika connection will receive error like below, and all the error handling and re-connection mechanism will NOT be invoked since the exception breaks the calls to _on_connection_closed which registered error handling callbacks.
"""
[2014-11-19 01:04:30,841][ERROR ][tornado.application:681] : Exception in I/O handler for fd 21#012Traceback (most recent call last):#1
2 File "/tornado/ioloop.py", line 671, in start#012 self._handlers[fd](fd,
events)#12 File "/tornado/stack_context.py", line 331, in wrapped#012 raise_exc_info(exc)#12 File "/tornado/stack_context.py", line 302, in wrapped#012
ret = fn(_args, *_kwargs)#12 File "/pika/adapters/base_connection.py”, line 322, in _handle_events#012 self._handle_read()#12
File "/pika/adapters/base_connection.py", line 348, in _handle_read#012
return self._handle_disconnect()#12 File "/pika/adapters/base_connection.py", line 248, in _handle_disconnect#012 self._adapter_disconnect()#12 File "/pika/adapters/tornado_connection.py", line 75, in _adapter_disconnect#012
super(TornadoConnection, self)._adapter_disconnect()#12 File "/pika/adapters/base_connection.py", line 137, in _adapter_disconnect#012
self._check_state_on_disconnect()#12 File "/pika/adapters/base_connection.py", line 149, in _check_state_on_disconnect#012
raise exceptions.IncompatibleProtocolError#012IncompatibleProtocolError
"""
/adapters/base_connection.py
In this scenario "IncompatibleProtocolError" is not treated as severe error and the connection can be recovered by re-connecting. Therefore I proposed that client can have option to skip this error for the appropriate scenario.
Thanks.