STOMP with ActiveMQ — sgcWebSockets | eSeGeCe

STOMP with ActiveMQ

Connect your Delphi applications to Apache ActiveMQ using STOMP over WebSocket. Access queues, topics, and durable subscriptions from native code.

TsgcWSPClient_STOMP_ActiveMQ

STOMP 1.0 / 1.1 / 1.2 client tuned for Apache ActiveMQ. Subscribe to /topic/, /queue/ and broker-specific destinations, ACK/NACK, transactions.

Component class

TsgcWSPClient_STOMP_ActiveMQ

Protocol

STOMP 1.2 for ActiveMQ

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop the component, set a few properties, go

Pair with a TsgcWebSocketClient, set Authentication, subscribe to /topic/ or /queue/ destinations, publish text or binary frames.

uses
  sgcWebSocket, sgcWebSocket_Classes, sgcWebSocket_Protocols,
  sgcWebSocket_Protocol_STOMP_Broker_Client,
  sgcWebSocket_Protocol_STOMP_ActiveMQ_Client;

var
  WSClient: TsgcWebSocketClient;
  STOMP: TsgcWSPClient_STOMP_ActiveMQ;
begin
  WSClient := TsgcWebSocketClient.Create(nil);
  WSClient.Host := 'broker.example.com';
  // 61614 is the ActiveMQ WebSocket connector, the plain
  // STOMP transport listens on 61613 (stomp+ssl on 61612)
  WSClient.Port := 61614;

  STOMP := TsgcWSPClient_STOMP_ActiveMQ.Create(nil);
  STOMP.Client := WSClient;
  STOMP.Authentication.Enabled  := True;
  STOMP.Authentication.UserName := 'admin';
  STOMP.Authentication.Password := 'admin';
  STOMP.ActiveMQ_Options.ClientId := 'delphi-client-1';

  STOMP.OnActiveMQConnected := ActiveMQConnected;
  STOMP.OnActiveMQMessage   := ActiveMQMessage;

  WSClient.Active := True;
end;

procedure TForm1.ActiveMQConnected(Connection: TsgcWSConnection;
  Headers: TsgcWSActiveMQSTOMPHeadersConnected);
begin
  STOMP.SubscribeQueue('orders');
  STOMP.PublishQueue('orders', 'hello');
end;

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

What's inside

9 published properties, 16 methods, 6 events — pulled from the component reference.

Connection

Published properties: Client, Broker, Versions.

Messaging

Events: OnActiveMQMessage, OnActiveMQReceipt.

Reliability

Published properties: HeartBeat.

Security

Published properties: Authentication.

Lifecycle

Events: OnActiveMQConnected, OnActiveMQDisconnected, OnActiveMQError.

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 ActiveMQ?

Download the free trial and integrate with ActiveMQ in minutes.