Closed bentcoder closed 4 years ago
connection.close
frames sent by the RabbitMQ node will contain a reason. As far as the server is concerned it has to force close client connections when the node is shut down as well as other cases. There are no separate error codes for each scenario in the protocol. Some other clients special case server initiated connection closure events but the user has to decide whether the library should recover from them.
Hi,
Currently we are unable to handle
*amqp.Error
correctly for closed connections. What I mean is, I wish to utiliseconn.NotifyClose
feature to reconnect which is a straightforward process. However, I want to skip reconnecting only if the connection was closed via the Management Plugin (UI). The problem is, error code for this action is320
(ConnectionForced
) which is same asdocker stop
,docker-compose down
andrabbitmqctl stop
. As you can see I cannot useif err.Code == 320
because it covers everything else. I don't want to takeerr.Reason
into account because it won't be reliable resource. What is the best solution for this?Thanks