gpt4 book ai didi

java - spring-rabbitmq 自动重试连接到代理

转载 作者:搜寻专家 更新时间:2023-11-01 03:17:40 27 4
gpt4 key购买 nike

我已经阅读了这个文档片段:

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 实体声明,那么是的,它们实际上是在建立连接时处理的。

关于java - spring-rabbitmq 自动重试连接到代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42981299/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com