๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • ์žฅ์›์ต ๊ธฐ์ˆ ๋ธ”๋กœ๊ทธ
๐Ÿ’Š Java & Kotlin & Spring/- spring framework +

[Spring Cloud] Spring Cloud Bus์™€ RabbitMQ ๋ฅผ ์ด์šฉํ•œ Config ์ •๋ณด ๋ฐ˜์˜ํ•˜๊ธฐ

by Wonit 2021. 5. 20.

ํ•ด๋‹น ๊ธ€์€ Spring Cloud Config ์—์„œ ๋ณ€๊ฒฝ๋œ ์ •๋ณด๋ฅผ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ์ธ์Šคํ„ด์Šค์—์„œ Spring Boot Actuator ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ฐ˜์˜ํ•˜๊ธฐ์— ์˜์กดํ•˜๋Š” ๊ธ€์ž…๋‹ˆ๋‹ค. ์‹ค์Šต ํ™˜๊ฒฝ์„ ๋”ฐ๋ผํ•˜์‹œ๋ ค๋ฉด ์ด์ „ ๊ธ€์— ๋‚˜์˜จ ์‹ค์Šต์„ ๋”ฐ๋ผํ•˜์‹œ๊ธธ ๊ถŒ๊ณ ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

๋ชฉ์ฐจ

  • ์ง€๋‚œ ์‹œ๊ฐ„์˜ ์„ค์ • ์ •๋ณด ๋ฐ˜์˜ ๋ฐฉ๋ฒ•
    • Spring Boot Actuator ๋ฅผ ์ด์šฉํ•œ ์„ค์ • ์ •๋ณด ๋ฐ˜์˜
  • Spring Cloud Bus๋ž€?
  • RabbitMQ๋ž€?
  • Spring Cloud Bus ์‹ค์Šตํ•˜๊ธฐ
    • RabbitMQ ๋“ฑ๋ก
      • Config, Gateway, User
    • Cloud Bus ๋“ฑ๋ก

์ง€๋‚œ ์‹œ๊ฐ„์˜ ์„ค์ • ์ •๋ณด ๋ฐ˜์˜ ๋ฐฉ๋ฒ•

์ง€๋‚œ ์‹œ๊ฐ„ ์šฐ๋ฆฌ๋Š” ์„ค์ • ์ •๋ณด๋ฅผ ์™ธ๋ถ€ Repository ๋กœ ๋ถ„๋ฆฌํ•˜๊ณ , ๊ฐ๊ฐ์˜ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค๋“ค์ด ํ•ด๋‹น ์„ค์ • ์ •๋ณด๋ฅผ ๊ฐ€์ ธ๊ฐ€๋Š” ์‹ค์Šต์„ ์œ„ํ•ด์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ตฌ์„ฑ์„ ํ•˜์˜€๋‹ค.

  • Spring Cloud Config๋ฅผ ์ด์šฉํ•ด์„œ Github Repository ์™€ ์—ฐ๋™ํ•˜์˜€๋‹ค.
  • Spring Boot Actuator ๋ฅผ ์ด์šฉํ•ด์„œ http Endpoint ๋กœ ์„ค์ • ์ •๋ณด๋ฅผ ๋ฐ˜์˜์‹œ์ผฐ๋‹ค.

๊ฐ„๋‹จํ•˜๊ฒŒ ์ง€๋‚œ ์‹œ๊ฐ„์„ ๋˜์งš์–ด๋ณด์ž.

Config ์„œ๋ฒ„ ์„ธํŒ…

์ง€๋‚œ ์‹œ๊ฐ„๊นŒ์ง€ ํ–ˆ๋˜ ์ž‘์—…์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

 

  1. Service Mesh ์„ธํŒ…
  2. User & Team Microservices ๊ตฌํ˜„
  3. ์„ค์ • ์ •๋ณด๋ฅผ ์ €์žฅํ•  Github Repository ์„ค์ •
  4. Config Server ๊ตฌํ˜„

Service Mesh ์„ธํŒ…

 

Config ์„œ๋ฒ„์˜ ์‹ค์Šต ํ™˜๊ฒฝ์„ ์œ„ํ•ด์„œ ์šฐ๋ฆฌ๋Š” Service Mesh ๋กœ Spring Cloud Gateway์™€ Spring Cloud Netflix Eureka ๋ฅผ ๊ฐ๊ฐ ๊ธฐ๋™ํ•˜์—ฌ Service Discovery์™€ Gateway ๋ฅผ ๊ตฌํ˜„ํ•˜์˜€๋‹ค.

 

์ด์— ๋Œ€ํ•ด์„œ ๊ถ๊ธˆํ•œ ์‚ฌํ•ญ์€ Spring Cloud Gateway ๋ฅผ ์ด์šฉํ•ด API Gateway ๊ตฌ์„ฑํ•˜๊ธฐ์™€ Service Discover Server๋กœ Netflix Eureka ์ด์šฉํ•˜๊ธฐ ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

Github Repository ์„ธํŒ…

 

์šฐ์„  Github Repository์— Configuration ํŒŒ์ผ์ธ application.yml ํŒŒ์ผ์„ ์˜ฌ๋ ค Config ์„œ๋ฒ„๊ฐ€ ํ•ด๋‹น ๋ ˆํฌ์ง€ํ† ๋ฆฌ์˜ ์ •๋ณด๋ฅผ ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ๊ฒŒ ์„ธํŒ…ํ•˜์˜€๋‹ค.

 

Config Server ์„ธํŒ…

 

Spring Cloud Config ๋ฅผ ์ด์šฉํ•ด์„œ Configuration ์„œ๋ฒ„์—์„œ ์„ค์ • ํŒŒ์ผ๋“ค์ด ์žˆ๋Š” github ์™€ ์—ฐ๋™์‹œ์ผฐ๋‹ค.

 

User & Team Microservices ์„ธํŒ…

๊ทธ๋ฆฌ๊ณ  User Service์™€ Team Servie ์—์„œ Config ์„œ๋ฒ„์™€ ์—ฐ๊ฒฐ์‹œ์ผœ Config ์„œ๋ฒ„๊ฐ€ Github ์—์„œ ๊ฐ€์ ธ์˜จ ์„ค์ • ํŒŒ์ผ๋“ค์„ ๊ฐ๊ฐ์˜ ์„œ๋น„์Šค์—์„œ ๋ฐ›์„ ์ˆ˜ ์žˆ๋„๋ก bootstrap.yml ํŒŒ์ผ์— ์ ์šฉํ•˜์˜€๋‹ค.

 

์ด์— ๋Œ€ํ•ด์„œ ๊ถ๊ธˆํ•œ ์‚ฌํ•ญ์€ ์„œ๋น„์Šค๋ฅผ ๋งŒ๋“ค๋ฉฐ OpenFeign ๊ณผ RestTemplate ๋น„๊ตํ•˜๊ธฐ ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์„ค์ • ์ •๋ณด ๋ณ€๊ฒฝํ•˜๊ธฐ ๋ฐ ๋ฐ˜์˜ํ•˜๊ธฐ

์„ค์ • ์ •๋ณด ๋ณ€๊ฒฝํ•˜๊ธฐ

์œ„์˜ ์„ธํŒ…์„ ๋ชจ๋‘ ์ ์šฉํ•˜๋ฉฐ ๊ฐ๊ฐ ์„œ๋น„์Šค๋“ค๊ณผ mesh ๋ฅผ ์‹คํ–‰์‹œ์ผœ๋ณด์ž.

 

๊ทธ๋ฆฌ๊ณ  ์„ค์ • ํŒŒ์ผ ํ•˜๋‚˜๋ฅผ ๋ณ€๊ฒฝํ•œ๋‹ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ• ๊ฐ€?

 

  • ๋ณ€๊ฒฝ ์‚ฌํ•ญ : test.message: this is version 1 -> test.message: this is version 2

์„ค์ • ์ •๋ณด ๋ฐ˜์˜ํ•˜๊ธฐ

์ด์ œ ๊ฐ๊ฐ์˜ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค์—์„œ ์„ค์ • ์ •๋ณด๋ฅผ ๋ฐ˜์˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ Spring Boot Actuator์˜ refresh ๊ธฐ๋Šฅ์„ ์œ„ํ•ด Postman ์— ๋“ค์–ด๊ฐ€์ž

๊ทธ๋ฆฌ๊ณ  ๊ฐ๊ฐ์˜ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค์˜ ์ฃผ์†Œ๋กœ https://my-service/actuator/refresh ๋ช…๋ น์„ ๋ณด๋‚ด๋ฉด ๋œ๋‹ค.

 

 

๊ทธ๋Ÿผ ์„ค์ • ์ •๋ณด๊ฐ€ ๋ฐ˜์˜๋œ๋‹ค.

 

๋ฌธ์ œ์ 

๊ทธ๋Ÿผ ๊ธฐ์กด์˜ ๋ฐฉ์‹์˜ ๋ฌธ์ œ์ ์ด๋ผ๋ฉด ๋ญ๊ฐ€ ์žˆ์„๊นŒ?

 

์•„๋งˆ ์„ค์ •์ด ๋ณ€๊ฒฝ๋˜๋ฉด ๋ชจ๋“  ์„œ๋ฒ„์—์„œ actuator refresh ํ•ด์•ผ ํ•œ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.

 

์ง€๊ธˆ์€ ์„œ๋น„์Šค๊ฐ€ 2๊ฐœ๋ฐ–์— ์—†์ง€๋งŒ ๋งŒ์•ฝ ์„œ๋น„์Šค๊ฐ€ 100๊ฐœ ๋ผ๋ฉด? 1000๊ฐœ๋ผ๋ฉด?? ๊ทธ๋Ÿผ ์ผ์ผ์ด ํ•ด๋‹น ์„œ๋น„์Šค๋“ค์˜ actuator๋ฅผ refresh ํ•ด์•ผ ํ•œ๋‹ค.

 

Container Orchestration ์ด ๋„์ž…๋˜์–ด Auto Scaling ๋œ๋‹ค๋ฉด ์ด ๋ฌธ์ œ์ ์€ ๋” ์‹ฌ๊ฐํ•ด์ง„๋‹ค.

 

์ด๋Ÿฐ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ Spring Cloud Bus ๋„์ž…์„ ๊ณ ๋ฏผํ•  ์ˆ˜ ์žˆ๋‹ค.

Spring Cloud Bus๋ž€?

Spring Cloud Bus ๋Š” ๋ถ„์‚ฐ ์‹œ์Šคํ…œ ํ™˜๊ฒฝ, ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ํ™˜๊ฒฝ์—์„œ ๊ฐ๊ฐ์˜ ๋…ธ๋“œ๋‚˜ ์„œ๋น„์Šค๋ฅผ ์—ฐ๊ฒฐ์‹œ์ผœ์ฃผ๋Š” ๊ฒฝ๋Ÿ‰ ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค์ด๋‹ค.

 

Spring Cloud Bus ๋ฅผ ์ด์šฉํ•œ๋‹ค๋ฉด Configuration ๋“ค์„ Broadcast ํ•˜๊ฒŒ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ ์šฉ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.

 

Spring Cloud Bus ๋Š” SpringBoot Application ์— ๋ถ€์ฐฉ๋˜์–ด ์„ค์ • ์ •๋ณด๋ฅผ ์ง€์†์ ์œผ๋กœ ๋ฐ˜์˜ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•œ๋‹ค.

 

๋” ์‰ฝ๊ฒŒ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด์„œ ์•„๋ž˜ ์„ค์ • ์ •๋ณด ์ ์šฉ ๊ณผ์ •์„ ํ•จ๊ป˜ ๋”ฐ๋ผ๊ฐ€๋ณด์ž.

 

์„ค์ • ์ •๋ณด ์ ์šฉ ๊ณผ์ •

์„ค์ • ์ •๋ณด๊ฐ€ ์ ์šฉ๋˜๋Š” ๊ณผ์ •์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

 

  1. ๊ฐœ๋ฐœ์ž๋Š” configuration file ์„ remote repository ์— push ํ•œ๋‹ค.
  2. Spring Cloud Bus ๊ฐ€ Message Broker ๋กœ ๋ณ€๊ฒฝ๋œ ์„ค์ • ์ •๋ณด์— ๋Œ€ํ•œ Message ๋ฅผ ๋ฐœํ–‰ํ•œ๋‹ค.
  3. Message Broker๋Š” ์„ค์ • ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๊ณ  ์žˆ๋Š”๋‹ค.
  4. ๊ฐœ๋ฐœ์ž๊ฐ€ ์„ค์ • ์ •๋ณด๊ฐ€ ๋ณ€๊ฒฝ๋˜์—ˆ์Œ์„ Config Server ์—๊ฒŒ ์•Œ๋ ค์ค€๋‹ค.
  5. Message Broker ๊ฐ€ ํ•ด๋‹น ๋ฉ”์‹œ์ง€๋ฅผ Subscribing ํ•˜๊ณ  ์žˆ๋Š” Application ๋“ค ์—๊ฒŒ Broadcasting ํ•œ๋‹ค.
  6. ๊ฐ๊ฐ์˜ Application ์€ Spring Cloud Bus ๊ฐ€ ๋ฐ›์€ ์„ค์ • ์ •๋ณด๋ฅผ ๋ฐ˜์˜ํ•œ๋‹ค.

 

์—ฌ๊ธฐ์„œ Message Broker ๊ฐ€ ๋ฌด์—‡์ธ์ง€ ๋ชจ๋ฅธ๋‹ค๋ฉด ํ•ด๋‹น ๋ธ”๋กœ๊ทธ์˜ Message Oriented Middleware๊ณผ Message Broker์˜ ์ฐจ์ด ๋ฐ ์›๋ฆฌ ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

 

ํ˜„์žฌ ๋‹ค์–‘ํ•œ Message Broker ๊ฐ€ ์กด์žฌํ•œ๋‹ค.

 

์šฐ์„  ์–ด๋–ค ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค๋ฅผ ์‚ฌ์šฉํ•  ๊ฒƒ์ธ์ง€๋ฅผ ์„ ํƒํ•ด๋ณด์ž

 

Message Broker ์„ ํƒํ•˜๊ธฐ

์šฐ๋ฆฌ์—๊ฒŒ๋Š” ์„ ํƒ์ง€๊ฐ€ 2๊ฐ€์ง€๊ฐ€ ์žˆ๋‹ค.

  1. RabbitMQ
  2. Kafka

 

RabbitMQ

์ดˆ๋‹น 20๊ฐœ ์ด์ƒ์˜ ๋ฉ”์‹œ์ง€๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๋Šฅ๋ ฅ์„ ๊ฐ€์ง„ ์˜คํ”ˆ์†Œ์Šค ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค์ด๋‹ค.


Point To Point Message Model์™€ Pub/Sub Message Model ๋ชจ๋‘๋ฅผ ์ง€์›ํ•˜์ง€๋งŒ Point To Point Message Model ์ด ๊ฐ€์žฅ ์ ํ•ฉํ•˜๋ฉฐ ์„ค์ • ์ •๋ณด์™€ ๊ฐ™์€ ๊ฐ€๋ณ๊ณ  ์ ์€ ๋ฐ์ดํ„ฐ๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ์— ์ ํ•ฉํ•˜๋‹ค.

 

Kafka

์ดˆ๋‹น 10๋งŒ๊ฐœ ์ด์ƒ์ด ๋ฉ”์‹œ์ง€, ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๋Šฅ๋ ฅ์„ ๊ฐ€์ง„ ์˜คํ”ˆ์†Œ์Šค ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค์ด๋‹ค.


Publisher๊ฐ€ Topic ์— ๋ฉ”์‹œ์ง€๋ฅผ ์ „๋‹ฌํ•˜๊ณ  ํ•ด๋‹น Topic์„ ๊ตฌ๋…ํ•˜๋Š” Subscriber ๊ฐ€ ๋ฉ”์‹œ์ง€๋ฅผ ๊ฐ€์ ธ๋‹ค ์‚ฌ์šฉํ•˜๋Š” ํ˜•ํƒœ๊ฐ€ ๋œ๋‹ค.


Kafka๋Š” ๋Œ€์šฉ๋Ÿ‰ ์ด๋ฒคํŠธ๋ฅผ ๋‹ค๋ฃจ๊ธฐ์— ์ ํ•ฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ณดํ†ต Spring Cloud Bus ์—์„œ๋Š” RabbitMQ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

 

์„ ํƒ์€ ๊ฒฝ๋Ÿ‰ ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค์ธ RabbitMQ์ด๋‹ค!

RabbitMQ ์„ค์น˜ํ•˜๊ธฐ

Rabbit MQ๋ฅผ ์„ค์น˜ํ•ด๋ณด์ž.


ํ˜„์žฌ ์‹ค์Šต ์šด์˜์ฒด์ œ๋Š” MacOS ์ด๋ฏ€๋กœ homebrew๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

 

$ brew update

$ brew install rabbitmq

$ export PATH=$PATH:/usr/local/sbin

$ rabbitmq-server

 

๋งŒ์•ฝ RabbitMQ๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰ํ•˜์˜€๋‹ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ™”๋ฉด์ด ํ„ฐ๋ฏธ๋„์— ๋‚˜์˜ค๊ฒŒ ๋œ๋‹ค.

 

์‹ค์Šตํ•˜๊ธฐ

์ด์ œ ์•„๊นŒ ์•ž์—์„œ ๊ตฌ์„ฑํ•œ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ๊ตฌ์กฐ์—์„œ ์‹ค์ œ๋กœ Configuration Server์™€ ๊ฐ๊ฐ Application ๋“ค์ด Spring Cloud Bus๋ฅผ ์ด์šฉํ•ด์„œ ์„ค์ • ์ •๋ณด๋ฅผ ๋ฐ˜์˜ํ•˜๋Š” ์‹ค์Šต์„ ํ•ด๋ณด์ž.

 

์ˆœ์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  1. ๊ฐ๊ฐ์˜ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค์—์„œ Spring Boot actuator์™€ Spring Cloud Bus ์˜์กด์„ฑ์„ ์ถ”๊ฐ€ํ•œ๋‹ค.
  2. application.yml ํŒŒ์ผ์—์„œ Spring Cloud Bus๊ณผ actuator ์ •๋ณด ์ถ”๊ฐ€ํ•˜๊ธฐ
  3. Rabbit MQ -> Config Service -> Microservices ๋ฅผ ์ฐจ๋ก€๋กœ ์‹คํ–‰์‹œํ‚ค๊ธฐ
  4. ์„ค์ • ํŒŒ์ผ ์ˆ˜์ •ํ•˜๊ณ  github๋กœ push ํ•˜๊ธฐ
  5. Config Server์˜ Bus Refresh ํ•˜๊ธฐ
  6. ํ…Œ์ŠคํŠธ

๊ฐ๊ฐ์˜ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค์—์„œ Spring Boot actuator์™€ Spring Cloud Bus ์˜์กด์„ฑ ์ถ”๊ฐ€ํ•˜๊ธฐ

Config ์„œ๋ฒ„์™€ Gateway ๋ฅผ ํฌํ•จํ•œ ๊ฐ๊ฐ์˜ ๋งˆ์ดํฌ๋กœ ์„œ๋น„์Šค์— 2๊ฐœ์˜ ์˜์กด์„ฑ์„ ์ถ”๊ฐ€์‹œ์ผœ์ฃผ์ž.

 

// Spring Cloud Bus + RabbitMQ
implementation 'org.springframework.cloud:spring-cloud-starter-bus-amqp'

// Spring Boot actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'

๊ฐ๊ฐ์˜ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค์—์„œ application.yml ํŒŒ์ผ์„ ์ˆ˜์ •ํ•ด์„œ Spring Cloud Bus ๋ฅผ ์—ฐ๊ฒฐ์‹œ์ผœ์ค€๋‹ค.

Config ์„œ๋ฒ„๊ฐ€ Github๋กœ ๋ถ€ํ„ฐ ๋ฐ›์€ ์„ค์ • ์ •๋ณด๋ฅผ RabbitMQ์— push ํ•˜๊ณ  ๊ฐ๊ฐ์˜ ์„œ๋ฒ„๊ฐ€ ํ•ด๋‹น Message๋ฅผ ์ˆ˜์‹ ํ•˜๊ธฐ ์œ„ํ•ด์„œ ๋ชจ๋“  ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๋Œ€ํ•ด์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์„ค์ • ์ •๋ณด๋ฅผ application.yml ์— ์ถ”๊ฐ€ํ•œ๋‹ค.

 

๋˜ํ•œ actuator๋ฅผ ์ด์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ endpoint์˜ busrefresh๋ฅผ ์—ด์–ด์ฃผ์ž.

 

spring:
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: guest
    password: guest

management:
  endpoints:
    web:
      exposure:
        include: busrefresh

์ˆœ์„œ๋Œ€๋กœ ์‹คํ–‰์‹œํ‚ค๊ธฐ

RabbitMQ, Config Server, User, Team MSA ์ˆœ์„œ๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ตฌ๋™์‹œ์ผœ์ฃผ์ž.

 

์„ค์ • ํŒŒ์ผ ์ˆ˜์ •ํ•˜๊ณ  github๋กœ push ํ•˜๊ธฐ

๊ธฐ์กด์— ์—ฐ๊ฒฐ๋˜์–ด์žˆ๋˜ github ์˜ ์„ค์ • ํŒŒ์ผ์„ ์ˆ˜์ •ํ•˜์ž.

 

test:
  message: this is version 3 update by using ampq-rabbitmq with spring cloud bus

 

๊ทธ๋ฆฌ๊ณ  github๋กœ push๋ฅผ ๋ณด๋‚ด์ฃผ์ž.

 

Config Server์˜ Bus Refresh ํ•˜๊ธฐ

๋งŒ์•ฝ Spring Cloud Bus ๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•˜๋”๋ผ๋ฉด Config Server, User Server, Team Server ๋“ฑ๋“ฑ ๋ชจ๋“  ์„œ๋ฒ„์—๊ฒŒ actuator๋กœ refresh ๋ช…๋ น์„ ๋ณด๋‚ด์•ผ ํ–ˆ์ง€๋งŒ, Spring Cloud Bus์˜ amqp๋ฅผ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ Config ์„œ๋ฒ„์—๊ฒŒ๋งŒ busrefresh ์š”์ฒญ์„ ๋ณด๋‚ด๋ฉด ๋ชจ๋“  ์„œ๋ฒ„๊ฐ€ consume ํ•˜๊ฒŒ ๋˜์–ด ์„ค์ • ์ •๋ณด๋ฅผ ๋ฐ˜์˜ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

 

์š”์ฒญ์€ localhost:8888/actuator/busrefresh ๋กœ ๋ณด๋‚ด์ฃผ๋ฉด ๋œ๋‹ค.

 

๊ทธ๋Ÿผ ์œ„์™€ ๊ฐ™์ด 204 No Content ๋กœ ์‘๋‹ต์„ ๋ฐ›๊ฒŒ ๋˜๊ณ  ๊ฐ๊ฐ์˜ ์„œ๋ฒ„๋Š” ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค์˜ Broadcast์— ์˜ํ•ด์„œ ์„ค์ • ์ •๋ณด๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

 

์‹ค์ œ๋กœ๋„ ์ž˜ ์ ์šฉ๋œ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

 

๋Œ“๊ธ€