STOMP Protocol
Simple Text Oriented Messaging Protocol for interoperable messaging. Connect to RabbitMQ, ActiveMQ, and any STOMP-compatible broker from your Delphi applications.
Simple Text Oriented Messaging Protocol for interoperable messaging. Connect to RabbitMQ, ActiveMQ, and any STOMP-compatible broker from your Delphi applications.
STOMP provides a simple, text-based messaging protocol that enables interoperability between different message brokers and client implementations.
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.
Enterprise messaging made simple with a clean, text-based protocol.
Human-readable frames make debugging and development straightforward. Each frame consists of a command, headers, and an optional body.
Fully compatible with RabbitMQ and ActiveMQ message brokers, providing access to enterprise messaging infrastructure.
Clean command set covering connection management, message sending, and topic subscription with clear semantics.
Request receipt confirmations from the broker to ensure your messages have been received and processed successfully.
Group multiple SEND and ACK operations into atomic transactions with BEGIN, COMMIT, and ABORT commands.
Automatic keep-alive mechanism to detect broken connections and maintain persistent broker sessions.
Enterprise messaging scenarios where STOMP provides simple, reliable communication.
Connect Delphi applications to enterprise message queues for reliable, asynchronous communication between systems.
Enable loosely-coupled communication between microservices using topic-based messaging and queue patterns.
Build event-driven systems where components react to events published through STOMP message brokers.
Bridge communication between applications written in different languages and frameworks through a common protocol.
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;