Let's start with an example to demonstrate a typical usage pattern.
unit ListQueues;
{$APPTYPE CONSOLE}
uses
AWS.SQS,
System.SysUtils;
var
SQS: ISQSClient;
begin
try
SQS := TSQSClient.Create;
var Response := SQS.ListQueues;
for var QueueUrl in Response.QueueUrls do
Writeln(QueueUrl);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
The key points to note are:
- We uses the relevant service unit AWS.SQS.
- We declare a variable for the client SQS: ISQSClient.
- We create a TSQSClient with default options and assign it to SQS.
- We make a ListQueues request and store the Response which will be a ISQSListQueuesResponse.
- We enumerate the QueueUrls writing each out to the console.
It's worth noting that each client implementation has a corresponding interface and implementation pair like the ISQSClient and TSQSClient as seen in the previous example. You are not required to use the I* interface but if not you will need to manually free the client once you are done using a try/finally block as with any other Delphi object.