0Pricing
WebSockets & Real-Time Systems with Spring · 강의

STOMP 브로커 릴레이 구성

메모리 내 단순 브로커를 STOMP 브로커 릴레이로 교체해 Spring이 RabbitMQ와 같은 실제 브로커로 메시지를 전달하도록 하고 수평 확장을 구현해 보세요.

STOMP 브로커 릴레이 구성은(는) CoddyKit의 무료 WebSockets & Real-Time Systems with Spring 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 WebSockets & Real-Time Systems with Spring 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. WebSockets & Real-Time Systems with Spring 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Limits of the Simple Broker

The default enableSimpleBroker keeps subscriptions and message routing in memory on one JVM. It is great for demos but cannot share state across instances, so it does not scale horizontally.

Enter the Broker Relay

A STOMP broker relay tells Spring to forward messages to a dedicated broker (RabbitMQ, ActiveMQ) that speaks STOMP. The broker, not the JVM, now handles routing and fan-out.

Why This Scales

With a central broker, every Spring instance connects to the same broker. A message published on node A reaches a subscriber on node B because both share the broker's topics and queues.

Enabling the Relay

Swap enableSimpleBroker for enableStompBrokerRelay in your config, pointing at the broker host and port.

registry.enableStompBrokerRelay("/topic", "/queue")
  .setRelayHost("rabbitmq")
  .setRelayPort(61613)
  .setClientLogin("guest")
  .setClientPasscode("guest");

Enabling STOMP on RabbitMQ

RabbitMQ speaks STOMP through a plugin you must enable. Port 61613 is the STOMP default.

rabbitmq-plugins enable rabbitmq_stomp

Application vs Broker Destinations

Keep the prefixes distinct:

  • /app → routed to your @MessageMapping controllers
  • /topic, /queue → routed straight to the broker relay
registry.setApplicationDestinationPrefixes("/app");

System Connection

Spring keeps a separate system connection to the broker for server-initiated messages (e.g. convertAndSend from a service). Configure its credentials too.

relay.setSystemLogin("guest")
     .setSystemPasscode("guest")
     .setSystemHeartbeatSendInterval(10000);

Heartbeats with the Relay

The relay maintains heartbeats with the broker to detect a dead broker connection. If the broker goes down, Spring attempts to reconnect automatically.

What the Broker Brings

A real broker adds capabilities the simple broker lacks:

  • Durable subscriptions that survive restarts
  • Message persistence to disk
  • Cross-node fan-out for clustering
  • Monitoring and management UIs

Reactive/Virtual Thread Note

The relay uses a Reactor Netty TCP client under the hood. Ensure the reactor-netty dependency is present, or the relay fails to start with a missing-class error.

<dependency>
  <groupId>io.projectreactor.netty</groupId>
  <artifactId>reactor-netty</artifactId>
</dependency>

Graceful Degradation

If the broker is unreachable at startup, the relay keeps retrying. Design clients to handle temporary delivery gaps and reconnect, rather than assuming the broker is always up.

Quick Check

Test your relay knowledge.

Recap

You moved routing to a real broker:

  • The simple broker is in-memory and single-node only
  • enableStompBrokerRelay forwards to RabbitMQ/ActiveMQ over STOMP
  • Enable the broker's STOMP plugin (port 61613)
  • Keep /app for controllers, /topic and /queue for the broker
  • The relay gives clustering, persistence, and durable subscriptions

자주 묻는 질문

“STOMP 브로커 릴레이 구성” 강의는 무료인가요?

네 — “STOMP 브로커 릴레이 구성” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 WebSockets & Real-Time Systems with Spring 강의 전체를 잠금 해제할 수 있습니다. WebSockets & Real-Time Systems with Spring 강의에는 총 4개의 강의가 포함되어 있습니다.

“STOMP 브로커 릴레이 구성”에서 뭘 배우나요?

메모리 내 단순 브로커를 STOMP 브로커 릴레이로 교체해 Spring이 RabbitMQ와 같은 실제 브로커로 메시지를 전달하도록 하고 수평 확장을 구현해 보세요. 브라우저에서 직접 실행하는 실습 코드로 WebSockets & Real-Time Systems with Spring을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

WebSockets & Real-Time Systems with Spring을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 WebSockets & Real-Time Systems with Spring은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“STOMP 브로커 릴레이 구성” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 WebSockets & Real-Time Systems with Spring 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 WebSockets & Real-Time Systems with Spring 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 외부 메시지 브로커의 필요성
  2. RabbitMQ/Kafka 통합
  3. 분산 WebSocket 아키텍처
  4. STOMP 브로커 릴레이 구성
← WebSockets & Real-Time Systems with Spring(으)로 돌아가기