Closed jingjiewei closed 4 years ago
Currently, automatic reconnect is not supported. However, you can implement this in your application by wrapping your code in a block that catches the raised connection exception, calls the connect
method on the connection instance and runs your code again.
Note that as mentioned in the docs, if connect()
fails to establish a link (e.g. due to transient network issues) it will wait and try again.
Currently, automatic reconnect is not supported. However, you can implement this in your application by wrapping your code in a block that catches the raised connection exception, calls the
connect
method on the connection instance and runs your code again.Note that as mentioned in the docs, if
connect()
fails to establish a link (e.g. due to transient network issues) it will wait and try again.
Thank a lot. Another question, in my customized "reconnect" method, is it possible to reuse the existing connection/channel/exchange/consumer? Since if it's a network issue, the old connection actually still exist. (Although in the plugin code, it will try to close the connection when the exception happens, but since network down, it will not take effect).
Really appreciate your help!
Please take a look at my response here. I think you will need to acquire a new channel and redefine your topology and any subscribers each time you reconnect.
thanks, really helpful
So after the network lost, the the client can connect to mq automatically?