programing

Rabbit 설정 방법스프링 토끼와의 MQ 연결?

bestprogram 2023. 3. 28. 22:45

Rabbit 설정 방법스프링 토끼와의 MQ 연결?

가이드에 따라 사용법을 배우고 있습니다.spring-rabbitRabbit MQ와 함께.하지만 이 가이드에서 토끼는MQ 설정은 디폴트(localhost 서버 및 guest/guest 자격 정보)입니다.원격 Rabbit에 연결하려면 어떻게 해야 합니까?IP 주소와 credential을 가진 MQ?어플리케이션에서 이 정보를 어디에 설정해야 할지 모르겠어요.

이 가이드의 어플리케이션은 Spring Boot 어플리케이션입니다.

파일 추가application.properties로.src/main/resources.

그런 다음 스프링 부트 설명서에 따라 rabbitmq 속성을 구성할 수 있습니다. rabbitmq 속성까지 아래로 스크롤합니다.

...
spring.rabbitmq.host=localhost # RabbitMQ host.
...
spring.rabbitmq.password= # Login to authenticate against the broker.
spring.rabbitmq.port=5672 # RabbitMQ port.
...
spring.rabbitmq.username= # Login user to authenticate to the broker.
...

클러스터에 연결하려면

spring.rabbitmq.addresses= # Comma-separated list of addresses to which the client should connect.

예.server1:5672,server2:5672.

부트 자동 설정을 사용하지 않는 경우는,CachingConnectionFactory @Bean필요에 따라서 설정합니다.

언급URL : https://stackoverflow.com/questions/42200317/how-to-configure-rabbitmq-connection-with-spring-rabbit