我已经阅读了这篇文档片段:
RabbitMQ Automatic Connection/Topology recovery
Since the first version of Spring AMQP, the framework has provided its
own connection and channel recovery in the event of a broker failure.
Also, as discussed in Section 3.1.10, “Configuring the broker”, the
RabbitAdmin will re-declare any infrastructure beans (queues etc) when
the connection is re-established. It therefore does not rely on the
Auto Recovery that is now provided by the amqp-client library. Spring
AMQP now uses the 4.0.x version of amqp-client, which has auto
recovery enabled by default. Spring AMQP can still use its own
recovery mechanisms if you wish, disabling it in the client, (by
setting the automaticRecoveryEnabled property on the underlying
RabbitMQ connectionFactory to false). However, the framework is
completely compatible with auto recovery being enabled. This means any
consumers you create within your code (perhaps via
RabbitTemplate.execute()) can be recovered automatically.
我不确定我是否正确理解.在我的application.properties中,我定义了端口和主机.在启动我的spring-boot应用程序期间,它成功建立了连接和所有必要的bean以与队列通信.
但是,如果在启动期间我的应用程序代理关闭,它将在应用程序启动后五分钟启动? spring-rabbitmq是否设法重新连接并定义所有bean?
最佳答案 那是对的. Spring AMQP自动管理重新连接和恢复.
该主题与bean定义无关.如果你谈论Broker实体声明,那么肯定是在连接建立时处理的.