Message Queues for Delphi
Offload work from your Delphi applications with Amazon SQS message queues.
Stop blocking the main thread
When a Delphi application handles everything synchronously, slow operations block the UI. Processing orders, generating reports, sending notifications in the main thread: if the application crashes mid-operation, the work is lost.
Amazon SQS gives you managed message queues. With the AWS SDK for Delphi, you push messages onto a queue and process them later, from the same application or a different one. Messages persist until they’re handled, so nothing gets lost.
Example
Send a message and poll for results:
uses
AWS.SQS;
var
SQS: ISQSClient;
QueuePoller: ISQSQueuePoller;
begin
SQS := TSQSClient.Create;
// Send a message
SQS.SendMessage(QueueURL, 'Order #1234 received');
// Poll for messages
QueuePoller := TSQSQueuePoller.Create(QueueURL);
QueuePoller.Poll(
procedure(const AMessages: TSQSMessages)
begin
for var Msg in AMessages do
ProcessOrder(Msg.Body);
end
);
end;
Good for
- Order processing and fulfilment workflows
- Background report generation
- Distributing work across multiple machines