티스토리 뷰

프로그래밍/Server

STOMP 맛보기

KYU 2020. 4. 13. 18:00
반응형

채팅을 구현하는 방식은 XMPP, Websocket 등 다양한 방식으로 구현하고 있습니다.

이번 포스트는 필자가 직접 사용하였던 STOMP에 대해서 간략하게 공유하려고 합니다.

필자의 주관적인 이해한 내용을 적다보니 잘못 기입된 부분이 있을 수 있습니다.

잘못 된 부분에 대해 댓글로 남겨주시면 수정 하겠습니다.



STOMP 무엇인가?

 

Simple (or Streaming) Text Oriented Message Protocol 의 약자인 STOMP는 텍스트 기반의 메세징 프로토콜 입니다.

STOMP 사용 환경은 TCP 나 WebSocket 과 같은 신뢰성있는 양방향 streaming network protocol 상에 사용될 수 있습니다.

문자로 설명으로 보는 것보다 STOMP 구조를 보면 이해하시는데 도움이 될 거 같습니다.



기본 STOMP

 

STOMP을 구성하게 되면 아래 그림과 같이 SEND → request → response → Message 를 받게 됩니다.

SEND 를 보면 /app, /topic 을 보내는 것을 확인 할 수 있습니다.

/app 으로 channel broker을 등록하고, /topic 을 통하여 통신을 하게 됩니다.



MQ 을 활용한 STOMP

 

Message Queue 을 활용 하여 STOMP을 활용한 화면입니다.

Message Borker 는 채널에 /topic 프로토콜 데이터가 왔을 시 가로채어 MQ에 연결된 모든 어플리케이션에게 메시지를 전달하게 되는 구조입니다.

Receive Client

- 메세지를 받기 위해 /topic을 사전에 서버에 subscribe(ex) /topic/[destination]) 되어야 합니다.

 

Send Client

- 채팅 서버와 연결된 클라이언트는 특정 path(로 ex) /app/[destination]) 전달합니다.

 

Broker

- 메세지 브로커는 Kafka, RabbitMQ, ActiveMQ 등의 오픈소스들 처럼 MQ 이며, pub/sub 모델을 따릅니다. 토픽에 따라 메세지를 전달해야 하는 사용자를 구분합니다.

- 연결된 클라이언트의 세션을 관리합니다.

- Topic과Message을 Mapping 하여, Topic을 구독하는 세션에 존재하는 클라이언트에게 메세지를 전달합니다.



STOMP Servers 라이브러리

 

STOMP 호환 메시지 서버는 다음과 같습니다.

Name Description Compliance
Apache ActiveMQ the most popular and powerful open source messaging and Integration Patterns server 1.0 1.1
Apache ActiveMQ Artemis Apache ActiveMQ Artemis has a proven non blocking architecture. It delivers outstanding performance. 1.0 1.1 1.2
Apache Apollo a redesigned version of ActiveMQ 1.0 1.1 1.2
CoilMQ a lightweight pure Python STOMP broker inspired by StompServer 1.0
Gozirra a lightweight Java STOMP broker 1.0
HornetQ puts the buzz in messaging 1.0
MorbidQ a STOMP publish/subscribe server with absolutely no potential to cluster 1.0
RabbitMQ an Erlang-based, multi-protocol broker with full support for STOMP via a plugin 1.0 1.1 1.2
Sprinkle written in Python and runs on Unix type platforms 1.0
Stampy a Java implementation of the STOMP 1.2 specification 1.2
StompConnect provides a bridge to any other JMS provider 1.0
StompServer a lightweight pure Ruby STOMP server 1.0



STOMP Clients 라이브러리

 

STOMP 호환 메시지 라이브러리는 다음과 같습니다.

Name
Language Description Compliance
activemessaging Ruby an attempt to bring the simplicity and elegance of Rails development to the world of messaging 1.0
AnyEvent::STOMP Perl a lightweight event-driven STOMP client 1.0
Apache CMS C++ is a JMS-like API for C++ 1.0
Apache NMS C# and .Net a JMS-like API for .Net 1.0
as3-stomp Flash an actionscript 3 implementation of the STOMP protocol 1.0
delphistompclient Delphi and FreePascal a STOMP client for Embarcadero Delphi and FreePascal 1.0
dstomp Dynamic C a STOMP client library written in Dynamic C for Rabbit 1.0
Gozirra Java a lightweight implementation of the STOMP specification 1.0
hxStomp Haxe a TCP socket-based STOMP protocol client library written for the Haxe language 1.0
libstomp C an APR based C library 1.0
Net::Stomp Perl a Streaming Text Orientated Messaging Protocol client 1.0
Net::STOMP::Client Perl STOMP object oriented client module 1.0 1.1 1.2
objc-stomp Objective-C a simple STOMP client based on AsynSocket 1.0
POE::Component::Client::Stomp Perl a Perl extension for the POE Environment 1.0
onstomp Ruby client library for message passing with brokers that support the STOMP protocol 1.0 1.1
Public.Protocols.Stomp Pike Public.Protocols.Stomp 1.0
pyactivemq Python module for communicating with the ActiveMQ message broker 1.0
React/STOMP PHP STOMP bindings for React 1.1
simplisticstompclient PHP a simpler STOMP client for PHP 1.0
Stampy Java a Java implementation of the STOMP 1.2 specification 1.2
stomp PHP STOMP client extension 1.0
stomp Ruby client for the STOMP messaging protocol 1.0 1.1
stomper Python a client implementation of the STOMP protocol 1.0
stomp.erl Erlang a STOMP client for Erlang 1.0
stompest Python a full-featured STOMP implementation for Python including both synchronous and asynchronous clients 1.0 1.1 1.2
StompKit Objective-C modern event-driven Objective-C library for STOMP 1.2
stompy Python implementation of the STOMP protocol in Python 1.0
stompngo Go a STOMP 1.1+ Client Package 1.0 1.1 1.2
stomp-php PHP the FuseSource PHP client implementation 1.0
stomp.py Python a Python client library which can also be run as a standalone, command-line client for testing. 1.0 1.1 1.2
stomp.js JavaScript is a JavaScript library for Web browsers using STOMP Over HTML Web Sockets 1.0 1.1
tStomp TCL a STOMP Implementation for TCL 1.1
Zend_Queue PHP for Zend PHP clients 1.0



마무리

 

텍스트 기반 메시지 프로토콜인 STOM 라이브러리를에 대해서 간단히 살펴봤습니다.

실시간 대응이 필요한 어플리케이션 개발 시 활용할 수 있는 STOMP은 매력적입니다.



참고

 

STOMP 위키백과

STOMP

반응형
댓글