简体   繁体   English

在 spring 引导运行时连接到不同的 rabbitmq 服务器和队列

[英]Connect to to different rabbitmq servers and queues at run time in spring boot

I have to create an application that is supposed to connect and consume messages from multiple RabbitMQ hosted in different locations with different ip, port, user, pwd, etc. I must be able to add and remove rabbitmq connections.我必须创建一个应用程序,该应用程序应该连接和使用来自多个 RabbitMQ 的消息,该多个 RabbitMQ 托管在具有不同 ip、端口、用户、密码等的不同位置。我必须能够添加和删除 rabbitmq 连接。 Moreover I'm not supposed to know connection properties so my application must connect at runtime (I'll take necessary info from a web service).此外,我不应该知道连接属性,所以我的应用程序必须在运行时连接(我将从 web 服务获取必要的信息)。 Is there a way todo so with Spring Boot?.有没有办法用 Spring Boot 做到这一点?

Boot will auto configure a single connection factory;引导将自动配置单个连接工厂; you can set autoStartup to false on the listener containers and reconfigure the underlying connection factory when you get the required info and then start the containers.您可以在侦听器容器上将 autoStartup 设置为 false,并在获取所需信息时重新配置底层连接工厂,然后启动容器。

If you need multiple connections to different servers concurrently, you will need to create your own connection factories when needed, and wire them into listener containers.如果您需要同时连接到不同服务器的多个连接,则需要在需要时创建自己的连接工厂,并将它们连接到侦听器容器中。 You can use Boot's auto configured container factory to create new containers.您可以使用 Boot 的自动配置容器工厂来创建新容器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 spring boot 无法连接rabbitmq - spring boot cannot connect to rabbitmq 在Spring Boot Rabbitmq中的运行时创建队列/交换/绑定/侦听器 - create queue/exchange/binding/listener at run time in spring boot rabbitmq 我可以在 rabbitMQ 和 spring 引导中将多个队列绑定到同一个使用者吗? - Can I bind multiple queues to the same consumer in rabbitMQ and spring boot? 不同帐户上的 Spring Boot、JmsListener 和 SQS 队列 - Spring Boot, JmsListener and SQS queues on different accounts Spring Amqp + RabbitMQ中基于异常的不同死信队列 - Different dead-letter-queues in Spring Amqp + RabbitMQ based on exception Spring引导WAR大小与不同的嵌入式服务器 - Spring boot WAR size with different embedded servers 我的远程服务器(Amazon EC2)是否需要运行2台不同的服务器才能运行EmberJS和Spring Boot? - Does my remote server (Amazon EC2) need 2 different servers running to run EmberJS and Spring Boot? 无法使用 Spring Boot 从另一台服务器连接rabbitmq - Unable to connect rabbitmq from another server using spring boot 在 Spring Boot 的应用程序属性中无需提供用户名和密码即可连接到 RabbitMQ - Connect to RabbitMQ without providing username and password in Application properties in Spring Boot 骆驼-RabbitMQ春季靴子 - Camel - RabbitMQ spring boot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM