mosquito / aiormq

Pure python AMQP 0.9.1 asynchronous client library
Other
268 stars 58 forks source link

Connection close #109

Open vit1251 opened 3 years ago

vit1251 commented 3 years ago

How to handle next error message:

DEBUG:aiormq.connection:Can not read bytes from server:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/aiormq/connection.py", line 381, in __reader
    weight, channel, frame = await self.__receive_frame()
  File "/usr/local/lib/python3.7/dist-packages/aiormq/connection.py", line 333, in __receive_frame
    frame_header = await self.reader.readexactly(1)
  File "/usr/lib/python3.7/asyncio/streams.py", line 677, in readexactly
    raise IncompleteReadError(incomplete, n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 1 expected bytes
mosquito commented 3 years ago

This means that the server closed the connection when the background task tried to get the frame header. You should not react to this, but I don't want to hide this cause it's shows the server disconnection.

vit1251 commented 3 years ago

@mosquito oh. There some misunderstanding, I well understand error message. How I can register callback or you may suggest better way to handle this error for re-connect routine for example? I think that network issue is most popular case in high load environment. For example in blocking pika we have callback with name on_error. Do u have suggest how to user can handle that error in their code?