如果Rabbitmq节点已关闭,我们启动Rabbitmq侦听器容器,以便循环无限时间,直到它连接到Rabbitmq Node.So我们如何能够阻止Listener Container的无限尝试,如果不是连接到Rabbitmq节点?
答案 0 :(得分:0)
你需要的是Listener Container
failedEvent,它被发射为;
private void logException(Throwable t) {
if (logger.isDebugEnabled()
|| !(t instanceof AmqpConnectException || t instanceof CancelledException)) {
logger.warn(
" raised exception, processing can restart if the connection factory supports it",
t);
}
else {
logger.warn(" raised exception, processing can restart if the connection factory supports it. "
+ "Exception summary: " + t);
}
publishFailedEvent(" raised exception, attempting restart", false, t);
}
因此,您可以监听这些事件并在达到某些条件时停止您的应用程序。