STOMP with RabbitMQ — sgcWebSockets | eSeGeCe

STOMP with RabbitMQ

Connect your Delphi applications to RabbitMQ using STOMP over WebSocket. Publish messages, subscribe to queues, and integrate with enterprise messaging infrastructure.

TsgcWSPClient_STOMP_RabbitMQ

STOMP 1.0 / 1.1 / 1.2 client tuned for the RabbitMQ Web-STOMP plugin. Topics, queues, externally-declared queues, temporary reply queues, transactions.

Component class

TsgcWSPClient_STOMP_RabbitMQ

Protocol

STOMP 1.2 via RabbitMQ Web-STOMP

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop the component, set a few properties, go

Pair with a TsgcWebSocketClient, set Authentication and a virtual host in Options, subscribe to /topic/ /queue/ /amq/queue/ or /temp-queue/ destinations.

uses
  sgcWebSocket, sgcWebSocket_Classes, sgcWebSocket_Protocols,
  sgcWebSocket_Protocol_STOMP_Broker_Client,
  sgcWebSocket_Protocol_STOMP_RabbitMQ_Client;

var
  WSClient: TsgcWebSocketClient;
  STOMP: TsgcWSPClient_STOMP_RabbitMQ;
begin
  WSClient := TsgcWebSocketClient.Create(nil);
  WSClient.Host := 'rabbit.example.com';
  WSClient.Port := 15674;
  WSClient.Options.Parameters := '/ws';

  STOMP := TsgcWSPClient_STOMP_RabbitMQ.Create(nil);
  STOMP.Client := WSClient;
  STOMP.Authentication.Enabled  := True;
  STOMP.Authentication.UserName := 'guest';
  STOMP.Authentication.Password := 'guest';
  STOMP.Options.VirtualHost := '/';

  STOMP.OnRabbitMQConnected := RabbitMQConnected;
  STOMP.OnRabbitMQMessage   := RabbitMQMessage;

  WSClient.Active := True;
end;

procedure TForm1.RabbitMQConnected(Connection: TsgcWSConnection;
  Headers: TsgcWSRabbitMQSTOMPHeadersConnected);
begin
  // /queue/orders is managed by the STOMP gateway
  STOMP.SubscribeQueue('orders');
  STOMP.PublishQueue('orders', 'hello');
end;

procedure TForm1.RabbitMQMessage(Connection: TsgcWSConnection;
  MessageText: String;
  Headers: TsgcWSRabbitMQSTOMPHeadersMessage;
  Subscription: TsgcWSBrokerSTOMPSubscriptionItem);
begin
  Memo1.Lines.Add(Headers.Destination + ': ' + MessageText);
end;

What's inside

8 published properties, 25 methods, 6 events — pulled from the component reference.

Connection

Published properties: Client, Broker, Versions.

Messaging

Events: OnRabbitMQMessage, OnRabbitMQReceipt.

Reliability

Published properties: HeartBeat.

Security

Published properties: Authentication.

Lifecycle

Events: OnRabbitMQConnected, OnRabbitMQDisconnected, OnRabbitMQError.

Advanced

Methods: WriteData.

Specifications & references

Authoritative sources for the protocols this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Demo Project — Demos\01.WebSocket_Quick_Start\02.WebSocket_Clients_APIs Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi, C++ Builder and .NET and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Connect to RabbitMQ?

Download the free trial and integrate with RabbitMQ in minutes.