STOMP Protocol

Simple Text Oriented Messaging Protocol for interoperable messaging. Connect to RabbitMQ, ActiveMQ, and any STOMP-compatible broker from your Delphi applications.

What is STOMP?

STOMP provides a simple, text-based messaging protocol that enables interoperability between different message brokers and client implementations.

Simple, Interoperable Messaging

STOMP is designed to be simple and easy to implement. Unlike binary protocols, STOMP uses a text-based frame format that is human-readable and straightforward to debug. It defines a small set of commands — CONNECT, SEND, SUBSCRIBE, UNSUBSCRIBE, ACK, NACK, BEGIN, COMMIT, ABORT, and DISCONNECT — that cover all common messaging patterns. sgcWebSockets implements the STOMP protocol over WebSocket connections, enabling browser and native clients to communicate with enterprise message brokers.

  • Human-readable text-based protocol
  • Works with any STOMP-compatible broker
  • Simple command set for rapid development
  • Runs over WebSocket for browser compatibility
SEND destination:/queue CLIENT BROKER

STOMP Features

Enterprise messaging made simple with a clean, text-based protocol.

Text-Based Protocol

Human-readable frames make debugging and development straightforward. Each frame consists of a command, headers, and an optional body.

RabbitMQ & ActiveMQ

Fully compatible with RabbitMQ and ActiveMQ message brokers, providing access to enterprise messaging infrastructure.

CONNECT/SEND/SUBSCRIBE

Clean command set covering connection management, message sending, and topic subscription with clear semantics.

Receipt Confirmation

Request receipt confirmations from the broker to ensure your messages have been received and processed successfully.

Transaction Support

Group multiple SEND and ACK operations into atomic transactions with BEGIN, COMMIT, and ABORT commands.

Heart-Beat Negotiation

Automatic keep-alive mechanism to detect broken connections and maintain persistent broker sessions.

STOMP Use Cases

Enterprise messaging scenarios where STOMP provides simple, reliable communication.

Enterprise Message Queuing

Connect Delphi applications to enterprise message queues for reliable, asynchronous communication between systems.

Microservices Communication

Enable loosely-coupled communication between microservices using topic-based messaging and queue patterns.

Event-Driven Architectures

Build event-driven systems where components react to events published through STOMP message brokers.

Cross-Platform Messaging

Bridge communication between applications written in different languages and frameworks through a common protocol.

Delphi STOMP Example

Connect to a STOMP broker, subscribe to a destination, and send messages.

uses
  sgcWebSocket_Client, sgcWebSocket_Types;

var
  WSClient: TsgcWebSocketClient;

procedure TForm1.FormCreate(Sender: TObject);
begin
  WSClient := TsgcWebSocketClient.Create(nil);
  WSClient.Host := 'broker.example.com';
  WSClient.Port := 15674;
  WSClient.Specifications.RFC6455.Protocol := 'stomp';

  // Configure STOMP protocol
  WSClient.STOMP.Enabled := True;
  WSClient.STOMP.Authentication.Username := 'guest';
  WSClient.STOMP.Authentication.Password := 'guest';
  WSClient.STOMP.VirtualHost := '/';
  WSClient.STOMP.HeartBeat.Outgoing := 10000;
  WSClient.STOMP.HeartBeat.Incoming := 10000;

  // Set up event handlers
  WSClient.OnSTOMPConnected := OnSTOMPConnected;
  WSClient.OnSTOMPMessage := OnSTOMPMessage;
  WSClient.OnSTOMPReceipt := OnSTOMPReceipt;
end;

procedure TForm1.ButtonConnectClick(Sender: TObject);
begin
  WSClient.Active := True;
end;

procedure TForm1.OnSTOMPConnected(Sender: TObject);
begin
  // Subscribe to a queue
  WSClient.STOMP.Subscribe('/queue/orders');
end;

procedure TForm1.OnSTOMPMessage(Sender: TObject;
  aDestination, aBody: string);
begin
  // Process incoming messages
  Memo1.Lines.Add(aDestination + ': ' + aBody);
end;

procedure TForm1.ButtonSendClick(Sender: TObject);
begin
  // Send a message to a destination
  WSClient.STOMP.Send('/queue/orders',
    '{"orderId": 12345, "status": "new"}');
end;

Ready to Get Started with STOMP?

Download the free trial and connect to enterprise message brokers in minutes.