sgcMQ: MQTT, AMQP, Kafka & STOMP Clients for Delphi & C++ Builder
Standalone product Windows, Linux, macOS, iOS & Android

sgcMQ: MQTT, AMQP, Kafka & STOMP Clients for Delphi & C++ Builder

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-specific STOMP clients for RabbitMQ and ActiveMQ. Every wire format is parsed and written in Object Pascal inside the library, so there is no external client library, no DLL and no wrapper to ship. sgcMQ is standalone, it bundles the sgcWebSockets Core runtime it is built on, so there is no base license to buy.

No base license required
Full source code
Six targets, one codebase
One carrier TsgcTCPClient Plain TCP or TLS, the same socket for every protocol
MQTT TsgcWSPClient_MQTT
AMQP 0.9.1 TsgcWSPClient_AMQP
AMQP 1.0 TsgcWSPClient_AMQP1
Kafka TsgcWSPClient_Kafka
STOMP TsgcWSPClient_STOMP
STOMP for RabbitMQ TsgcWSPClient_STOMP_RabbitMQ
STOMP for ActiveMQ TsgcWSPClient_STOMP_ActiveMQ
7 Client components One page on the component palette
5 Protocol families MQTT, AMQP 0.9.1, AMQP 1.0, Kafka, STOMP
6 Target platforms Win32, Win64, Linux64, macOS, iOS, Android
0 External libraries No librdkafka, no Paho, no Qpid, no DLL
1 Transport carrier One TsgcTCPClient serves them all

Two Things Worth Knowing First

What sgcMQ needs from you, and how the bytes reach the broker. Both answers are short.

★ No base license required

sgcMQ is self-contained

It does not sit on top of a base product. Everything the components need is bundled inside sgcMQ: the sgcWebSockets Core runtime, the TCP carrier TsgcTCPClient, the TLS layer and the JSON helpers. One SKU, one installer, nothing else to buy.

Full source code ships with every license, so the protocol implementations step through in your own debugger rather than disappearing into a binary.

Transport scope

sgcMQ is plain TCP and TLS

Every protocol in the pack rides on a raw socket, opened plain or wrapped in TLS. That covers the native broker ports, which is how MQTT, AMQP, Kafka and STOMP are normally deployed, and it needs nothing beyond what is in the box.

Running a protocol over WebSocket instead, for example MQTT over WebSocket or Web-STOMP, requires the WebSocket client, and that ships with sgcWebSockets, not with sgcMQ. Check which transport your broker exposes before you choose.

Seven Clients, Five Protocol Families

Each one is a non-visual component you drop on a form or create in code. You attach the carrier through the Client property, wire the protocol 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.

MQTT1 component

Publish, subscribe and the whole QoS machinery

TsgcWSPClient_MQTT covers MQTT 3.1.1 and MQTT 5.0 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 for challenge and response schemes.

TsgcWSPClient_MQTT MQTT 3.1.1 · MQTT 5.0
AMQP2 components

Two protocols that share a name and nothing else

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 and ISO/IEC 19464 standard behind Azure Service Bus and Event Hubs: containers, sessions, sender and receiver links, credit-based flow control, SASL and the Claims-Based Security token helpers. Different wire format, different object model, so sgcMQ ships a component for each instead of pretending one API fits both.

Apache Kafka1 component

The binary protocol, spoken directly

TsgcWSPClient_Kafka talks the Kafka wire protocol over TCP, including the v2 record batch format. There is no REST proxy in front and no librdkafka underneath. Produce single records or batches 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 directly by offset. Offset commit, topic create and delete, group listing and the broker capability probe are all first-class calls.

TsgcWSPClient_Kafka Producer · Consumer groups · Admin
STOMP3 components

One generic client, two broker dialects

TsgcWSPClient_STOMP handles STOMP 1.0, 1.1 and 1.2: SEND, SUBSCRIBE, UNSUBSCRIBE, ACK, NACK, receipts, bidirectional heart-beating and the BEGIN, COMMIT and ABORT transaction frames, with the accepted versions advertised through Versions. The two descendants turn broker destination conventions into named methods: RabbitMQ gets /queue, /topic, /exchange, /amq/queue and /temp-queue helpers, ActiveMQ gets queue and topic helpers plus an ActiveMQ_Options property for the broker's own headers.

Published Protocols, So the Broker Is Your Choice

sgcMQ implements the specifications rather than wrapping a vendor SDK, so anything that speaks these protocols on the wire is a candidate. The same component works against a self-hosted broker and a managed cloud service without a code change, and swapping broker is a host, a port and a set of credentials.

RabbitMQ TsgcWSPClient_AMQP

AMQP 0.9.1 natively. The STOMP and MQTT plugins are reachable too, each with its own component.

Apache Kafka TsgcWSPClient_Kafka

The broker's own binary protocol on 9092, and any Kafka-wire-compatible broker.

Eclipse Mosquitto TsgcWSPClient_MQTT

The reference lightweight MQTT broker, plain on 1883 or TLS on 8883.

HiveMQ TsgcWSPClient_MQTT

Full MQTT 5.0, including shared subscriptions and user properties.

EMQX TsgcWSPClient_MQTT

MQTT 3.1.1 and 5.0, self-hosted or on the vendor's cloud.

Apache ActiveMQ TsgcWSPClient_STOMP_ActiveMQ

STOMP on 61613, or AMQP 1.0 against Artemis with the AMQP 1.0 component.

Azure Service Bus TsgcWSPClient_AMQP1

AMQP 1.0 with the Claims-Based Security helpers, and Event Hubs on the same component.

AWS IoT Core TsgcWSPClient_MQTT

MQTT over TLS with client certificates, configured through the carrier's TLSOptions.

One Carrier Under Every Protocol

Assign a TsgcTCPClient to the protocol component's Client property and the frames go straight onto the socket. Encryption, proxy traversal, IPv6 and reconnect are settings on that carrier, so they are configured once and behave identically whether the protocol above them is MQTT, AMQP, Kafka or STOMP.

MQTT 3.1.1 and 5.0 TsgcWSPClient_MQTT
TCP1883The default MQTT listener.
TLS8883Switch on TLS on the carrier.
AMQP 0.9.1 TsgcWSPClient_AMQP
TCP5672RabbitMQ's default listener.
TLS5671The amqps listener.
AMQP 1.0 TsgcWSPClient_AMQP1
TCP5672Same port number, different protocol.
TLS5671What Azure Service Bus expects.
Apache Kafka TsgcWSPClient_Kafka
TCP9092The plaintext listener.
TLS9093Whatever the broker's own SSL listener is configured as.
STOMP, RabbitMQ plugin TsgcWSPClient_STOMP_RabbitMQ
TCP61613The native STOMP port.
TLS61614The plugin's encrypted listener.
STOMP, ActiveMQ TsgcWSPClient_STOMP_ActiveMQ
TCP61613The native STOMP connector.
TLS61612The broker's stomp+ssl connector.

The generic TsgcWSPClient_STOMP uses 61613 as well, against any STOMP-capable broker. These are the conventional defaults, and the carrier's Port takes whatever your deployment actually listens on.

TLS the way you prefer

TLSOptions.IOHandler picks OpenSSL for cross-platform builds, or SChannel on Windows when you would rather not ship OpenSSL binaries at all. Mutual TLS reads a client certificate from a PEM file, a PKCS#12 bundle or the Windows certificate store.

Reconnect and keep-alive

The carrier's WatchDog reconnects after a dropped link with a configurable interval and attempt count, and each protocol adds its own liveness: MQTT keep-alive pings, AMQP heartbeats, STOMP heart-beating and Kafka consumer-group heartbeats.

Proxies and IPv6

HTTP CONNECT proxy support is on the carrier, so a broker behind a corporate proxy is reachable, and an IPv6 broker address needs no extra configuration.

Events, not a polling loop

Reading runs on its own thread and inbound frames arrive as typed events: OnMQTTPublish, OnAMQPBasicDeliver, OnKafkaMessage, OnSTOMPMessage. Set the carrier's notify settings to marshal them onto the main thread for VCL and FMX code.

Subscribe and Publish over MQTT

Pair a TsgcTCPClient with the protocol component, set the credentials, wire the events, then call the protocol verbs. The same shape in Object Pascal and C++ Builder, and the same shape for the other six components.

uses
  sgcTCP_Client_WS, sgcWebSocket_Classes, sgcWebSocket_Types,
  sgcWebSocket_Protocols, sgcWebSocket_Protocol_MQTT_Client,
  sgcWebSocket_Protocol_MQTT_Message;

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);
  MQTT.Publish('devices/sensor-01/status',
    'online', mtqsAtLeastOnce, True);   // retained
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;
// include: sgcTCP_Client_WS.hpp, sgcWebSocket_Protocols.hpp,
// sgcWebSocket_Protocol_MQTT_Client.hpp,
// sgcWebSocket_Protocol_MQTT_Message.hpp

TsgcTCPClient *TCPClient = new TsgcTCPClient(this);   // plain MQTT over TCP
TCPClient->Host = "broker.example.com";
TCPClient->Port = 1883;
TCPClient->WatchDog->Enabled = true;

TsgcWSPClient_MQTT *MQTT = new TsgcWSPClient_MQTT(this);
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;

void __fastcall TForm1::MQTTPublish(TsgcWSConnection *Connection,
    UnicodeString aTopic, UnicodeString aText,
    TsgcWSMQTTPublishProperties PublishProperties)
{
  Memo1->Lines->Add(aTopic + " = " + aText);
}

MQTT->Subscribe("sensors/+/temperature", mtqsAtLeastOnce);
MQTT->Publish("sensors/room1/temperature",
  "{\"value\":22.5,\"unit\":\"C\"}", mtqsAtLeastOnce, true);

// For an encrypted broker: same code, TLS on the carrier.
TCPClient->Port = 8883;
TCPClient->TLS  = true;

Six Targets, No Asterisk

The messaging pack carries no platform restriction. All seven clients and the carrier under them are registered for every target the compiler produces, from a Windows service to an Android handset, out of one source tree.

All 7 protocol clients MQTT, AMQP 0.9.1, AMQP 1.0, Kafka and the three STOMP clients
Windows Win32 Windows Win64 Linux64 macOS iOS Android
The TsgcTCPClient carrier Socket, TLS, proxy, IPv6 and WatchDog reconnect
Windows Win32 Windows Win64 Linux64 macOS iOS Android
TLS engine Chosen with TLSOptions.IOHandler
OpenSSL, every target SChannel, Windows only
IDE support One source tree, design-time packages per version
Delphi 7 to 13 C++ Builder
WebSocket carrier MQTT over WebSocket, Web-STOMP and similar
Not in sgcMQ Needs a sgcWebSockets package

See the full standards and platform table on the features page →

A Standalone Package

sgcMQ is licensed on its own, starting at €249 for a single developer. All licenses include full source code, 1 year of updates and a 50% to 70% renewal discount: 50% when you renew one pack, 60% for two, 70% for three or more. sgcAI and sgcMQ each count as a pack.

sgcMQ

€249

Single, Team and Site licenses available.

  • MQTT 3.1.1 & 5.0 client
  • AMQP 0.9.1 & AMQP 1.0 clients
  • Apache Kafka client
  • STOMP, RabbitMQ & ActiveMQ clients
  • sgcWebSockets Core runtime included
  • Delphi & C++ Builder, all six targets
  • Full source code
  • 1 year of updates
★ No base license required

sgcMQ includes the sgcWebSockets Core runtime, so there is nothing else to buy.

Checkout lists two items: the sgcWebSockets Core runtime entitlement, which is charged at zero, and the sgcMQ pack itself. Full pricing details.

3,000+Developers
20+Years
761+Components
30+API Integrations
5Platforms
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 runtime bundled in and full source code in the box. Windows, Linux, macOS, iOS and Android from the same code.

Other Products by eSeGeCe

Pair sgcMQ with our other Delphi, C++ Builder and .NET component libraries.

sgcWebSockets

The full library: WebSocket clients and servers, HTTP/2, IoT, P2P and AI components. This is where the WebSocket carrier lives.

Learn more →

sgcQUIC

QUIC (RFC 9000) and HTTP/3 (RFC 9114) client and server components built on the native OpenSSL 3.5 QUIC engine.

Learn more →

sgcAI

AI, LLM and MCP components. One chat component reaches OpenAI, Anthropic, Gemini, DeepSeek, Ollama, Grok and Mistral.

Learn more →

sgcHTML

Data-aware server-side HTML/UI components for Delphi, C++ Builder and .NET, with Bootstrap 5 and htmx.

Learn more →

sgcSign

Enterprise digital signatures. XAdES, PAdES, CAdES and ASiC with 10 key providers and 21 EU country profiles.

Learn more →

sgcOpenAPI

OpenAPI 3.0 parser and SDK generator. Turn any OpenAPI spec into a strongly-typed Delphi client in seconds.

Learn more →