Lianja
Lianja
SQS Create Queue
See more Amazon SQS Examples
Creates a new SQS queue.See SQS CreateQueue or detailed information.
Chilkat Lianja Downloads
llSuccess = .F.
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loRest = createobject("CkRest")
// Connect to the Amazon AWS REST server.
// such as https://sqs.us-west-2.amazonaws.com/
llBTls = .T.
lnPort = 443
llBAutoReconnect = .T.
llSuccess = loRest.Connect("sqs.us-west-2.amazonaws.com",lnPort,llBTls,llBAutoReconnect)
// Provide AWS credentials for the REST call.
loAuthAws = createobject("CkAuthAws")
loAuthAws.AccessKey = "AWS_ACCESS_KEY"
loAuthAws.SecretKey = "AWS_SECRET_KEY"
// the region should match our URL above..
loAuthAws.Region = "us-west-2"
loAuthAws.ServiceName = "sqs"
loRest.SetAuthAws(loAuthAws)
loRest.AddQueryParam("Action","CreateQueue")
loRest.AddQueryParam("QueueName","testQueue")
loRest.AddQueryParam("Attribute.1.Name","VisibilityTimeout")
loRest.AddQueryParam("Attribute.1.Value","40")
lcResponseXml = loRest.FullRequestNoBody("GET","/")
if (loRest.LastMethodSuccess <> .T.) then
? loRest.LastErrorText
release loRest
release loAuthAws
return
endif
// A successful response will have a status code equal to 200.
if (loRest.ResponseStatusCode <> 200) then
? "response status code = " + str(loRest.ResponseStatusCode)
? "response status text = " + loRest.ResponseStatusText
? "response header: " + loRest.ResponseHeader
? "response body: " + lcResponseXml
release loRest
release loAuthAws
return
endif
// Examine the successful XML response.
loXml = createobject("CkXml")
loXml.LoadXml(lcResponseXml)
? loXml.GetXml()
// A sample CreateQueue response:
// <CreateQueueResponse>
// <CreateQueueResult>
// <QueueUrl>
// http://queue.amazonaws.com/123456789012/testQueue
// </QueueUrl>
// </CreateQueueResult>
// <ResponseMetadata>
// <RequestId>
// 7a62c49f-347e-4fc4-9331-6e8e7a96aa73
// </RequestId>
// </ResponseMetadata>
// </CreateQueueResponse>
release loRest
release loAuthAws
release loXml