Data.Cloud.AmazonAPI.TAmazonQueueService

From RAD Studio API Documentation
Jump to: navigation, search

Data.Cloud.AmazonAPI.TAmazonBasicServiceData.Cloud.AmazonAPI.TAmazonServiceData.Cloud.CloudAPI.TCloudServiceSystem.TObjectTAmazonQueueService

Delphi

TAmazonQueueService = class(TAmazonBasicService)

C++

class PASCALIMPLEMENTATION TAmazonQueueService : public TAmazonBasicService

Properties

Type Visibility Source Unit Parent
class public
Data.Cloud.AmazonAPI.pas
Data.Cloud.AmazonAPI.hpp
Data.Cloud.AmazonAPI Data.Cloud.AmazonAPI

Description

Allows you to connect to the Amazon Simple Queue Service (SQS).

This class provides methods that you can use to:

Additionally, TAmazonQueueService provides some methods that return the response in an XML-parsed format:

For more information about the Amazon Simple Queue Service (SQS) API, see the official Amazon Simple Queue Service Documentation.

The following code snippet demonstrates how to create a new queue using the TAmazonQueueService class:

Delphi:

var
  ResponseInfo: TCloudResponseInfo;
  QueueURL: String;
  QueueService: TAmazonQueueService;
begin
  QueueService := TAmazonQueueService.Create(AmazonConnectionInfo1);
  ResponseInfo := TCloudResponseInfo.Create;
  try 
    if QueueService.CreateQueue('QueueName', QueueURL, -1, ResponseInfo) then
      Memo1.Lines.Append('Success! QueueURL: ' + QueueURL);
    else
      Memo1.Lines.Append(Format('Failure! %s', [ResponseInfo.StatusMessage]));
  finally
    QueueService.Free;
    ResponseInfo.Free;
  end;
end;

C++:

TCloudResponseInfo *ResponseInfo;
String QueueURL;
TAmazonQueueService *QueueService;
QueueService = new TAmazonQueueService(AmazonConnectionInfo1);
ResponseInfo = new TCloudResponseInfo;
try
{
    if (QueueService->CreateQueue("testqueue", QueueURL, -1, ResponseInfo))
    {
        Memo1->Lines->Append("Success! QueueURL: " + QueueURL);
    }
    else
    {
        TVarRec args[1] = {ResponseInfo->StatusMessage};
        Memo1->Lines->Append(Format("Failure! %s", args, 0));
    }
}
__finally
{
    delete QueueService;
    delete ResponseInfo;
}

See Also