Closed Tatikoma closed 4 years ago
I also added code to disconnect client from server, if server forced connection close. But i saved exception for backward compatability.
I working on cluster connection wrapper and this fix is important for me. I have multiple connections to rabbitmq in case of failures. If i dont close connection, then i dont know which client produced exception and cant handle. This way i just checking isConnected().
Way to reproduce:
- create async Bunny client instance and connect to rabbitmq server
- stop rabbitmq application with rabbitmqctl stop_app
Would be nice to add tests for this in a follow up PR
I working on cluster connection wrapper and this fix is important for me. I have multiple connections to rabbitmq in case of failures. If i dont close connection, then i dont know which client produced exception and cant handle. This way i just checking isConnected().
Are you making that into a package? Could be useful
Sorry, i'm not enough familiar with testing. Just checking my code plenty times.
Cluster wrapper is packaged, but i will ask my chief if i can publish it.
@Tatikoma no worries, will have a look soon. If you chief does let you publish it, please ping me here or open an issue. Alternatively, we can consider adding it to this package
Hello, currently bunny incorrectly handling rabbitmq server shutdown.
Way to reproduce:
Expected result ClientException, that i can handle and call $client->disconnect().
Actual result ClientException, but when i try to call $client->disconnect() it produces new exception:
This way client never run to state ClientStateEnum::NOT_CONNECTED and any attempts to close connection will produce new exceptions.
I using it with amphp with ReactAdapter, but i think it doesnt matter. This patch cant break something, so i guess it can be easily merged to upstream.
PS: $client->disconnect() is only place where "$this->eventLoop->removeReadStream($this->getStream());" is located. So i think that i should call this method when server closes connection.