eSeGeCe — Enterprise Communication Components for Delphi & .NET
FEATURED · sgcMQ

Every broker, one carrier

Seven client components speak MQTT 3.1.1 and 5.0, AMQP 0.9.1, AMQP 1.0, the Apache Kafka wire protocol and STOMP 1.0 through 1.2, with broker dialects for RabbitMQ and ActiveMQ. Every frame is parsed and written in Object Pascal inside the library, so there is no librdkafka, no Paho, no Qpid and no DLL to ship. All seven ride on one TsgcTCPClient, opened plain or wrapped in TLS.

  • 7 client components
  • 5 protocol families
  • Windows · Linux · macOS · iOS · Android
  • Delphi 7 to 13 · C++ Builder

Five Protocol Families, Seven Components

sgcMQ is a standalone package. It bundles the sgcWebSockets Core runtime it is built on, and every license ships with full source code, so the protocol implementations step through in your own debugger.

7 Client components MQTT, AMQP 0.9.1, AMQP 1.0, Kafka, STOMP, STOMP RabbitMQ and STOMP ActiveMQ, on one palette page.
5 Protocol families Each wire format parsed and written in Object Pascal, inside the library.
6 Target platforms Win32, Win64, Linux64, macOS, iOS and Android, out of one source tree.
0 External libraries No librdkafka, no Paho, no Qpid, no DLL and no REST proxy in front.
1 Transport carrier One TsgcTCPClient carries all seven, so TLS, proxy and reconnect are configured once.
sgcMQ

Message queue and streaming clients for Delphi and C++ Builder. A standalone package with the sgcWebSockets Core runtime bundled in, full source code, and royalty-free deployment on all six targets.

One Component per Protocol, One API Style

Drop the protocol component on a form, assign a TsgcTCPClient to its Client property, wire the events, then call the protocol's own verbs. The naming is consistent across all seven, so learning one gets you most of the way through the rest.

MQTT 3.1.1 & 5.0

Publish, Subscribe and the Whole QoS Machinery

TsgcWSPClient_MQTT covers both protocol versions behind one MQTTVersion property. QoS 0, 1 and 2 with the PUBACK, PUBREC, PUBREL and PUBCOMP exchange surfaced as events rather than hidden, retained messages, Last Will and Testament, wildcard subscriptions and resumable sessions. Version 5 adds reason codes, user properties, topic aliases, shared subscriptions and the AUTH round trip.

View the MQTT client →
AMQP 0.9.1 & 1.0

Two Protocols That Share a Name

TsgcWSPClient_AMQP speaks AMQP 0.9.1, the protocol RabbitMQ was built for: channels, exchange and queue declaration, bindings, consumers, publisher acknowledgements, prefetch QoS and transactions. TsgcWSPClient_AMQP1 speaks AMQP 1.0, the OASIS standard behind Azure Service Bus and Event Hubs: containers, sessions, sender and receiver links, credit-based flow control, SASL and the Claims-Based Security helpers. Different wire format, different object model, so there is a component for each.

AMQP 0.9.1 → AMQP 1.0 →
Apache Kafka

The Binary Protocol, Spoken Directly

TsgcWSPClient_Kafka talks the Kafka wire protocol over TCP, including the v2 record batch format. Produce with a chosen acks level and gzip compression, consume through a group where coordinator discovery, join, sync, heartbeat and rebalance are handled for you, or read a partition by offset.

View the Kafka client →
STOMP 1.0 to 1.2

One Generic Client, Two Broker Dialects

TsgcWSPClient_STOMP handles SEND, SUBSCRIBE, UNSUBSCRIBE, ACK, NACK, receipts, bidirectional heart-beating and the BEGIN, COMMIT and ABORT transaction frames. Two descendants turn broker destination conventions into named methods, one for RabbitMQ and one for ActiveMQ.

View the STOMP clients →
Cross-platform

Six Targets, No Asterisk

All seven clients and the carrier under them are registered for Win32, Win64, Linux64, macOS, iOS and Android, from Delphi 7 through RAD Studio 13 and on C++ Builder. The messaging pack carries no platform restriction.

The feature matrix →

Reference pages for each component:

Four Protocols, the Same Shape

Create the protocol component, assign the carrier, hook the events, call the verbs. Switching from a plain listener to an encrypted one is a port number and TLS := True on the carrier, and nothing above it changes.

uses
  sgcTCP_Client_WS, sgcWebSocket_Classes, sgcWebSocket_Protocols;
var
  TCPClient: TsgcTCPClient;
  MQTT: TsgcWSPClient_MQTT;
begin
  TCPClient := TsgcTCPClient.Create(nil);   // plain MQTT over TCP
  TCPClient.Host := 'broker.example.com';
  TCPClient.Port := 1883;
  TCPClient.WatchDog.Enabled := True;

  MQTT := TsgcWSPClient_MQTT.Create(nil);
  MQTT.Client := TCPClient;
  MQTT.MQTTVersion := mqtt5;
  MQTT.Authentication.Enabled  := True;
  MQTT.Authentication.UserName := 'sgc';
  MQTT.Authentication.Password := 'sgc';

  MQTT.LastWillTestament.Enabled := True;
  MQTT.LastWillTestament.Topic   := 'devices/sensor-01/status';
  MQTT.LastWillTestament.Message := 'offline';
  MQTT.LastWillTestament.QoS     := mtqsAtLeastOnce;
  MQTT.LastWillTestament.Retain  := True;

  MQTT.OnMQTTConnect := MQTTConnect;
  MQTT.OnMQTTPublish := MQTTPublish;

  TCPClient.Active := True;
end;

procedure TForm1.MQTTConnect(Connection: TsgcWSConnection;
  const Session: Boolean; const ReasonCode: Integer;
  const ReasonName: string;
  const ConnectProperties: TsgcWSMQTTCONNACKProperties);
begin
  MQTT.Subscribe('sensors/+/temperature', mtqsAtLeastOnce);
end;

procedure TForm1.MQTTPublish(Connection: TsgcWSConnection;
  aTopic, aText: string;
  PublishProperties: TsgcWSMQTTPublishProperties);
begin
  Memo1.Lines.Add(aTopic + ' = ' + aText);
end;

// For an encrypted broker: same code, TLS on the carrier.
// TCPClient.Port := 8883; TCPClient.TLS := True;
uses
  sgcTCP_Client_WS, sgcWebSocket_Protocols, sgcAMQP_Classes;
var
  TCPClient: TsgcTCPClient;
  AMQP: TsgcWSPClient_AMQP;
begin
  TCPClient := TsgcTCPClient.Create(nil);
  TCPClient.Host := 'broker.example.com';
  TCPClient.Port := 5672;                  // 5671 for the amqps listener

  AMQP := TsgcWSPClient_AMQP.Create(nil);
  AMQP.Client := TCPClient;
  AMQP.AMQPOptions.VirtualHost := '/';
  AMQP.HeartBeat.Enabled  := True;
  AMQP.HeartBeat.Interval := 30;

  AMQP.OnAMQPConnect      := AMQPConnect;
  AMQP.OnAMQPBasicDeliver := AMQPBasicDeliver;

  TCPClient.Active := True;
end;

procedure TForm1.AMQPConnect(Sender: TObject);
begin
  AMQP.OpenChannel('ch1');
  AMQP.DeclareExchange('ch1', 'orders', 'direct');
  AMQP.DeclareQueue('ch1', 'orders_in');
  AMQP.BindQueue('ch1', 'orders_in', 'orders', 'create');
  AMQP.Consume('ch1', 'orders_in');

  // Publish to the exchange with a routing key
  AMQP.PublishMessage('ch1', 'orders', 'create', '{"id":42}');
end;
uses
  sgcTCP_Client_WS, sgcWebSocket_Protocols, sgcKafka_Classes;
var
  TCPClient: TsgcTCPClient;
  Kafka: TsgcWSPClient_Kafka;
begin
  Kafka := TsgcWSPClient_Kafka.Create(nil);
  Kafka.KafkaOptions.ClientId := 'my-delphi-app';
  Kafka.KafkaOptions.Producer.Acks        := kafkaAcksLeader;
  Kafka.KafkaOptions.Producer.Compression := kafkaCompressionGzip;
  Kafka.KafkaOptions.Consumer.GroupId     := 'my-group';
  Kafka.KafkaOptions.Consumer.OffsetReset := kafkaOffsetEarliest;
  Kafka.OnKafkaMessage := KafkaMessage;

  TCPClient := TsgcTCPClient.Create(nil);
  Kafka.Client := TCPClient;
  TCPClient.Host := '127.0.0.1';
  TCPClient.Port := 9092;
  TCPClient.Active := True;

  // produce a record to a topic
  Kafka.Produce('my-topic', 'Hello Kafka', 'key-1');

  // consume: subscribe once, then Poll repeatedly (e.g. from a timer)
  Kafka.Subscribe(['my-topic']);
end;

procedure TForm1.KafkaMessage(Sender: TObject;
  const Message: TsgcKafkaMessage);
begin
  Memo1.Lines.Add(Message.GetKeyString + ' = ' + Message.GetValueString);
end;

// fetch records from a timer, commit when a batch is processed
var
  Messages: TsgcKafkaMessages;
begin
  Messages := Kafka.Poll(1000);
  try
    if Messages.Count > 0 then
      Kafka.CommitSync;
  finally
    Messages.Free;
  end;
end;
uses
  sgcTCP_Client_WS, sgcWebSocket_Classes, sgcWebSocket_Protocols,
  sgcWebSocket_Protocol_STOMP_Broker_Client,
  sgcWebSocket_Protocol_STOMP_RabbitMQ_Client;
var
  TCPClient: TsgcTCPClient;
  STOMP: TsgcWSPClient_STOMP_RabbitMQ;
begin
  TCPClient := TsgcTCPClient.Create(nil);
  TCPClient.Host := 'rabbit.example.com';
  TCPClient.Port := 61613;             // 61614 for the plugin's TLS listener

  STOMP := TsgcWSPClient_STOMP_RabbitMQ.Create(nil);
  STOMP.Client := TCPClient;
  STOMP.Authentication.Enabled  := True;
  STOMP.Authentication.UserName := 'guest';
  STOMP.Authentication.Password := 'guest';

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

  TCPClient.Active := True;
end;

procedure TForm1.RabbitMQConnected(Connection: TsgcWSConnection;
  Headers: TsgcWSRabbitMQSTOMPHeadersConnected);
begin
  // /queue/orders
  STOMP.SubscribeQueue('orders');
  STOMP.PublishQueue('orders', '{"orderId":12345}');
end;

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

The same shape in Object Pascal and in C++ Builder, and the same shape for the other three components. The full feature matrix →

Two Things Worth Knowing First

What sgcMQ needs from you, and how the bytes reach the broker. Both answers are short, and both are on this page rather than in the small print.

Native broker listeners
protocol            component                       TCP     TLS
MQTT 3.1.1 / 5.0    TsgcWSPClient_MQTT             1883    8883
AMQP 0.9.1          TsgcWSPClient_AMQP             5672    5671
AMQP 1.0            TsgcWSPClient_AMQP1            5672    5671
Apache Kafka        TsgcWSPClient_Kafka            9092       *
STOMP               TsgcWSPClient_STOMP           61613       *
STOMP, RabbitMQ     TsgcWSPClient_STOMP_RabbitMQ  61613   61614
STOMP, ActiveMQ     TsgcWSPClient_STOMP_ActiveMQ  61613   61612

* whatever the broker's own encrypted listener is configured as.
  These are the conventional defaults. The carrier's Port takes
  whatever your deployment actually listens on.

sgcMQ is standalone

Everything the components need is bundled inside sgcMQ: the sgcWebSockets Core runtime, the TsgcTCPClient carrier, the TLS layer and the JSON helpers. One installer, full source code in the box.

Plain TCP and TLS, and only that

Every protocol in the pack rides on a raw socket, opened plain or wrapped in TLS. That covers the native broker ports listed here, which is how MQTT, AMQP, Kafka and STOMP are normally deployed. Running a protocol over WebSocket instead, for example MQTT over WebSocket or Web-STOMP, needs the WebSocket client, and that ships with sgcWebSockets. Check which transport your broker exposes before you choose.

Delphi and C++ Builder

sgcMQ targets Delphi 7 through RAD Studio 13 and C++ Builder, on all six platforms. There is no .NET build of this pack. If you need messaging from .NET, that lives in sgcWebSockets.

The carrier does the plumbing

TLSOptions.IOHandler picks OpenSSL for cross-platform builds or SChannel on Windows, WatchDog reconnects after a dropped link, and HTTP CONNECT proxy traversal and IPv6 need no extra configuration. Set it once and every protocol above it inherits it.

OpenSSL SChannel Mutual TLS HTTP proxy WatchDog reconnect

Every component and property →

sgcMQ implements the published protocols rather than wrapping a vendor SDK, so the broker is your choice: RabbitMQ, Apache Kafka, Eclipse Mosquitto, HiveMQ, EMQX, Apache ActiveMQ, Azure Service Bus and Event Hubs, or AWS IoT Core. Swapping broker is a host, a port and a set of credentials.

Nine Libraries, One Toolbox

sgcMQ is one of ten eSeGeCe component libraries for Delphi, C++ Builder and .NET. They share conventions, they ship with full source, and they deploy royalty-free.

sgcMQ

MQTT, AMQP 0.9.1 and 1.0, Apache Kafka and STOMP client components for Delphi and C++ Builder. Standalone, with the sgcWebSockets Core runtime bundled in.

Learn more →

sgcWebSockets

WebSocket, HTTP/2, MQTT, AMQP, WebRTC, AI and 30+ API integrations for Delphi, C++ Builder, Lazarus and .NET. This is where the WebSocket carrier lives.

Learn more →

sgcHTML

Server-side HTML and UI components on Bootstrap 5 and htmx. Put a live dashboard in front of the queues sgcMQ consumes.

Learn more →

sgcQUIC

Raw QUIC transport and an HTTP/3 client and server, with WebTransport. An add-on to sgcWebSockets Enterprise.

Learn more →

sgcAI

AI, LLM and MCP components for Delphi and C++ Builder. Seven LLM providers behind one component, plus MCP, embeddings and speech. Standalone, with the sgcWebSockets Core runtime bundled in.

Learn more →

sgcOpenAPI

OpenAPI 3.x parser, native Pascal SDK generator, OpenAPI server component, and 1,195+ pre-built cloud SDKs.

Learn more →

sgcSign

XAdES, PAdES, CAdES and ASiC for documents, Authenticode, ClickOnce, NuGet and VSIX for code.

Learn more →

sgcBiometrics

Windows Hello, fingerprint sensors and the Windows Biometric Framework for Delphi and C++ Builder.

Learn more →

sgcIndy

Updated Indy TCP/IP components with modern TLS, IPv6 and HTTP/2 for Delphi 7 through 13.

Learn more →

View pricing and licenses Download the free trial

What Developers Say

Trusted by Delphi, C++ Builder, Lazarus and .NET developers around the world.

Your sgcWebSockets library is very useful and easy to setup. Keep up the good work!

Simone Moretti Delphi Developer

sgcWebSockets is amazing and your support is the best!

Christian Meyer Founder & CTO

Thanks so much for your help and support, I love your components.

Mark Steinfeld CTO

Latest from the blog

View all posts →

You are seeing the Messaging view of eSeGeCe.

Show me another angle →
30-Day Money-Back GuaranteeNot satisfied? Request a full refund within 30 days of purchase. See refund policy

Talk to Your Broker from Delphi

MQTT, AMQP, Kafka and STOMP in one package, natively implemented, with the sgcWebSockets Core runtime bundled in and full source code in the box. Windows, Linux, macOS, iOS and Android from the same code.