AMQP Protocol
Advanced Message Queuing Protocol for reliable enterprise messaging. Full support for AMQP 0.9.1 and 1.0, compatible with RabbitMQ and Azure Service Bus.
Advanced Message Queuing Protocol for reliable enterprise messaging. Full support for AMQP 0.9.1 and 1.0, compatible with RabbitMQ and Azure Service Bus.
AMQP is an open standard for enterprise messaging that provides reliable, interoperable message delivery across different platforms and implementations.
AMQP defines a wire-level protocol for message-oriented middleware, ensuring true interoperability between different vendor implementations. Its sophisticated routing model based on exchanges, queues, and bindings supports complex messaging patterns including direct routing, topic-based routing, fan-out, and header-based routing. sgcWebSockets implements both AMQP 0.9.1 (the widely-deployed version used by RabbitMQ) and AMQP 1.0 (the OASIS standard used by Azure Service Bus), giving you maximum flexibility.
Industrial-strength messaging features for mission-critical applications.
Messages are never lost with publisher confirms and consumer acknowledgments ensuring end-to-end delivery guarantees.
Flexible routing through direct, topic, fanout, and headers exchanges bound to queues with configurable routing keys.
Consumers explicitly acknowledge processed messages. Unacknowledged messages are automatically requeued for redelivery.
Group publish and acknowledge operations into atomic transactions that either all succeed or all roll back.
Built-in flow control prevents fast producers from overwhelming slow consumers, ensuring stable system performance.
Multiple logical channels over a single TCP connection, reducing connection overhead while maintaining isolation.
Tested and verified with RabbitMQ (AMQP 0.9.1) and Azure Service Bus (AMQP 1.0) for production deployments.
Mission-critical messaging scenarios where reliability and interoperability matter most.
Process financial transactions with guaranteed delivery and exactly-once semantics for banking and payment systems.
Manage order workflows with reliable message queuing between order entry, fulfillment, shipping, and notification systems.
Build an enterprise service bus connecting disparate systems with reliable, asynchronous message delivery.
Distribute work across multiple processing nodes with task queues and result collection patterns.
Capture and route audit events to logging systems with guaranteed delivery, ensuring no audit trail entries are lost.
Connect to an AMQP broker, declare queues, and exchange messages.
uses
sgcAMQP_Client, sgcAMQP_Classes;
var
AMQPClient: TsgcAMQPClient;
procedure TForm1.FormCreate(Sender: TObject);
begin
AMQPClient := TsgcAMQPClient.Create(nil);
AMQPClient.Host := 'rabbitmq.example.com';
AMQPClient.Port := 5672;
AMQPClient.Authentication.Username := 'guest';
AMQPClient.Authentication.Password := 'guest';
AMQPClient.VirtualHost := '/';
// Set up event handlers
AMQPClient.OnAMQPConnect := OnAMQPConnect;
AMQPClient.OnAMQPMessage := OnAMQPMessage;
AMQPClient.Connect;
end;
procedure TForm1.OnAMQPConnect(Sender: TObject);
begin
// Open a channel
AMQPClient.OpenChannel(1);
// Declare a queue
AMQPClient.DeclareQueue(1, 'orders',
False, True, False, False);
// Start consuming messages
AMQPClient.BasicConsume(1, 'orders',
'consumer-1', False, False, False, False);
end;
procedure TForm1.OnAMQPMessage(Sender: TObject;
aChannel: Integer; aMessage: TsgcAMQPMessage);
begin
// Process the message
Memo1.Lines.Add('Received: ' + aMessage.Body);
// Acknowledge the message
AMQPClient.BasicAck(aChannel, aMessage.DeliveryTag, False);
end;
procedure TForm1.ButtonPublishClick(Sender: TObject);
begin
// Publish a message to the default exchange
AMQPClient.BasicPublish(1, '', 'orders',
'{"orderId": 67890, "total": 99.95}');
end;