Did this page help you?

   Yes   No   Tell us about it...

com.amazonaws.services.sqs
Class AmazonSQSClient

java.lang.Object
  extended by com.amazonaws.AmazonWebServiceClient
      extended by com.amazonaws.services.sqs.AmazonSQSClient
All Implemented Interfaces:
AmazonSQS
Direct Known Subclasses:
AmazonSQSAsyncClient

public class AmazonSQSClient
extends AmazonWebServiceClient
implements AmazonSQS

Client for accessing AmazonSQS. All service calls made using this client are blocking, and will not return until the service call completes.


Constructor Summary
AmazonSQSClient()
          Constructs a new client to invoke service methods on AmazonSQS.
AmazonSQSClient(AWSCredentials awsCredentials)
          Constructs a new client to invoke service methods on AmazonSQS using the specified AWS account credentials.
AmazonSQSClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration)
          Constructs a new client to invoke service methods on AmazonSQS using the specified AWS account credentials and client configuration options.
AmazonSQSClient(AWSCredentialsProvider awsCredentialsProvider)
          Constructs a new client to invoke service methods on AmazonSQS using the specified AWS account credentials provider.
AmazonSQSClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration)
          Constructs a new client to invoke service methods on AmazonSQS using the specified AWS account credentials provider and client configuration options.
AmazonSQSClient(ClientConfiguration clientConfiguration)
          Constructs a new client to invoke service methods on AmazonSQS.
 
Method Summary
 void addPermission(AddPermissionRequest addPermissionRequest)
           
 void changeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest)
           
 ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest)
           
 CreateQueueResult createQueue(CreateQueueRequest createQueueRequest)
           
 void deleteMessage(DeleteMessageRequest deleteMessageRequest)
           
 DeleteMessageBatchResult deleteMessageBatch(DeleteMessageBatchRequest deleteMessageBatchRequest)
           
 void deleteQueue(DeleteQueueRequest deleteQueueRequest)
           
 ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request)
          Returns additional metadata for a previously executed successful, request, typically used for debugging issues where a service isn't acting as expected.
 GetQueueAttributesResult getQueueAttributes(GetQueueAttributesRequest getQueueAttributesRequest)
           
 GetQueueUrlResult getQueueUrl(GetQueueUrlRequest getQueueUrlRequest)
           
 ListQueuesResult listQueues()
           
 ListQueuesResult listQueues(ListQueuesRequest listQueuesRequest)
           
 ReceiveMessageResult receiveMessage(ReceiveMessageRequest receiveMessageRequest)
           
 void removePermission(RemovePermissionRequest removePermissionRequest)
           
 SendMessageResult sendMessage(SendMessageRequest sendMessageRequest)
           
 SendMessageBatchResult sendMessageBatch(SendMessageBatchRequest sendMessageBatchRequest)
           
 void setEndpoint(String endpoint, String serviceName, String regionId)
          Overrides the default endpoint for this client ("sqs.us-east-1.amazonaws.com") and explicitly provides an AWS region ID and AWS service name to use when the client calculates a signature for requests.
 void setQueueAttributes(SetQueueAttributesRequest setQueueAttributesRequest)
           
 
Methods inherited from class com.amazonaws.AmazonWebServiceClient
addRequestHandler, getTimeOffset, removeRequestHandler, setConfiguration, setEndpoint, setRegion, setTimeOffset, shutdown, withTimeOffset
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.amazonaws.services.sqs.AmazonSQS
setEndpoint, setRegion, shutdown
 

Constructor Detail

AmazonSQSClient

public AmazonSQSClient()
Constructs a new client to invoke service methods on AmazonSQS. A credentials provider chain will be used that searches for credentials in this order:

All service calls made using this new client object are blocking, and will not return until the service call completes.

See Also:
DefaultAWSCredentialsProvider

AmazonSQSClient

public AmazonSQSClient(ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AmazonSQS. A credentials provider chain will be used that searches for credentials in this order:

All service calls made using this new client object are blocking, and will not return until the service call completes.

Parameters:
clientConfiguration - The client configuration options controlling how this client connects to AmazonSQS (ex: proxy settings, retry counts, etc.).
See Also:
DefaultAWSCredentialsProvider

AmazonSQSClient

public AmazonSQSClient(AWSCredentials awsCredentials)
Constructs a new client to invoke service methods on AmazonSQS using the specified AWS account credentials.

All service calls made using this new client object are blocking, and will not return until the service call completes.

Parameters:
awsCredentials - The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.

AmazonSQSClient

public AmazonSQSClient(AWSCredentials awsCredentials,
                       ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AmazonSQS using the specified AWS account credentials and client configuration options.

All service calls made using this new client object are blocking, and will not return until the service call completes.

Parameters:
awsCredentials - The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
clientConfiguration - The client configuration options controlling how this client connects to AmazonSQS (ex: proxy settings, retry counts, etc.).

AmazonSQSClient

public AmazonSQSClient(AWSCredentialsProvider awsCredentialsProvider)
Constructs a new client to invoke service methods on AmazonSQS using the specified AWS account credentials provider.

All service calls made using this new client object are blocking, and will not return until the service call completes.

Parameters:
awsCredentialsProvider - The AWS credentials provider which will provide credentials to authenticate requests with AWS services.

AmazonSQSClient

public AmazonSQSClient(AWSCredentialsProvider awsCredentialsProvider,
                       ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AmazonSQS using the specified AWS account credentials provider and client configuration options.

All service calls made using this new client object are blocking, and will not return until the service call completes.

Parameters:
awsCredentialsProvider - The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
clientConfiguration - The client configuration options controlling how this client connects to AmazonSQS (ex: proxy settings, retry counts, etc.).
Method Detail

setQueueAttributes

public void setQueueAttributes(SetQueueAttributesRequest setQueueAttributesRequest)
                        throws AmazonServiceException,
                               AmazonClientException
Specified by:
setQueueAttributes in interface AmazonSQS
Parameters:
setQueueAttributesRequest - Container for the necessary parameters to execute the SetQueueAttributes service method on AmazonSQS.
Throws:
InvalidAttributeNameException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

changeMessageVisibilityBatch

public ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest)
                                                                throws AmazonServiceException,
                                                                       AmazonClientException
Specified by:
changeMessageVisibilityBatch in interface AmazonSQS
Parameters:
changeMessageVisibilityBatchRequest - Container for the necessary parameters to execute the ChangeMessageVisibilityBatch service method on AmazonSQS.
Returns:
The response from the ChangeMessageVisibilityBatch service method, as returned by AmazonSQS.
Throws:
BatchEntryIdsNotDistinctException
TooManyEntriesInBatchRequestException
InvalidBatchEntryIdException
EmptyBatchRequestException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

changeMessageVisibility

public void changeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest)
                             throws AmazonServiceException,
                                    AmazonClientException
Specified by:
changeMessageVisibility in interface AmazonSQS
Parameters:
changeMessageVisibilityRequest - Container for the necessary parameters to execute the ChangeMessageVisibility service method on AmazonSQS.
Throws:
ReceiptHandleIsInvalidException
MessageNotInflightException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

getQueueUrl

public GetQueueUrlResult getQueueUrl(GetQueueUrlRequest getQueueUrlRequest)
                              throws AmazonServiceException,
                                     AmazonClientException
Specified by:
getQueueUrl in interface AmazonSQS
Parameters:
getQueueUrlRequest - Container for the necessary parameters to execute the GetQueueUrl service method on AmazonSQS.
Returns:
The response from the GetQueueUrl service method, as returned by AmazonSQS.
Throws:
QueueDoesNotExistException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

removePermission

public void removePermission(RemovePermissionRequest removePermissionRequest)
                      throws AmazonServiceException,
                             AmazonClientException
Specified by:
removePermission in interface AmazonSQS
Parameters:
removePermissionRequest - Container for the necessary parameters to execute the RemovePermission service method on AmazonSQS.
Throws:
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

getQueueAttributes

public GetQueueAttributesResult getQueueAttributes(GetQueueAttributesRequest getQueueAttributesRequest)
                                            throws AmazonServiceException,
                                                   AmazonClientException
Specified by:
getQueueAttributes in interface AmazonSQS
Parameters:
getQueueAttributesRequest - Container for the necessary parameters to execute the GetQueueAttributes service method on AmazonSQS.
Returns:
The response from the GetQueueAttributes service method, as returned by AmazonSQS.
Throws:
InvalidAttributeNameException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

sendMessageBatch

public SendMessageBatchResult sendMessageBatch(SendMessageBatchRequest sendMessageBatchRequest)
                                        throws AmazonServiceException,
                                               AmazonClientException
Specified by:
sendMessageBatch in interface AmazonSQS
Parameters:
sendMessageBatchRequest - Container for the necessary parameters to execute the SendMessageBatch service method on AmazonSQS.
Returns:
The response from the SendMessageBatch service method, as returned by AmazonSQS.
Throws:
BatchEntryIdsNotDistinctException
TooManyEntriesInBatchRequestException
BatchRequestTooLongException
InvalidBatchEntryIdException
EmptyBatchRequestException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

deleteQueue

public void deleteQueue(DeleteQueueRequest deleteQueueRequest)
                 throws AmazonServiceException,
                        AmazonClientException
Specified by:
deleteQueue in interface AmazonSQS
Parameters:
deleteQueueRequest - Container for the necessary parameters to execute the DeleteQueue service method on AmazonSQS.
Throws:
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

sendMessage

public SendMessageResult sendMessage(SendMessageRequest sendMessageRequest)
                              throws AmazonServiceException,
                                     AmazonClientException
Specified by:
sendMessage in interface AmazonSQS
Parameters:
sendMessageRequest - Container for the necessary parameters to execute the SendMessage service method on AmazonSQS.
Returns:
The response from the SendMessage service method, as returned by AmazonSQS.
Throws:
InvalidMessageContentsException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

receiveMessage

public ReceiveMessageResult receiveMessage(ReceiveMessageRequest receiveMessageRequest)
                                    throws AmazonServiceException,
                                           AmazonClientException
Specified by:
receiveMessage in interface AmazonSQS
Parameters:
receiveMessageRequest - Container for the necessary parameters to execute the ReceiveMessage service method on AmazonSQS.
Returns:
The response from the ReceiveMessage service method, as returned by AmazonSQS.
Throws:
OverLimitException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

listQueues

public ListQueuesResult listQueues(ListQueuesRequest listQueuesRequest)
                            throws AmazonServiceException,
                                   AmazonClientException
Specified by:
listQueues in interface AmazonSQS
Parameters:
listQueuesRequest - Container for the necessary parameters to execute the ListQueues service method on AmazonSQS.
Returns:
The response from the ListQueues service method, as returned by AmazonSQS.
Throws:
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

deleteMessageBatch

public DeleteMessageBatchResult deleteMessageBatch(DeleteMessageBatchRequest deleteMessageBatchRequest)
                                            throws AmazonServiceException,
                                                   AmazonClientException
Specified by:
deleteMessageBatch in interface AmazonSQS
Parameters:
deleteMessageBatchRequest - Container for the necessary parameters to execute the DeleteMessageBatch service method on AmazonSQS.
Returns:
The response from the DeleteMessageBatch service method, as returned by AmazonSQS.
Throws:
BatchEntryIdsNotDistinctException
TooManyEntriesInBatchRequestException
InvalidBatchEntryIdException
EmptyBatchRequestException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

createQueue

public CreateQueueResult createQueue(CreateQueueRequest createQueueRequest)
                              throws AmazonServiceException,
                                     AmazonClientException
Specified by:
createQueue in interface AmazonSQS
Parameters:
createQueueRequest - Container for the necessary parameters to execute the CreateQueue service method on AmazonSQS.
Returns:
The response from the CreateQueue service method, as returned by AmazonSQS.
Throws:
QueueNameExistsException
QueueDeletedRecentlyException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

addPermission

public void addPermission(AddPermissionRequest addPermissionRequest)
                   throws AmazonServiceException,
                          AmazonClientException
Specified by:
addPermission in interface AmazonSQS
Parameters:
addPermissionRequest - Container for the necessary parameters to execute the AddPermission service method on AmazonSQS.
Throws:
OverLimitException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

deleteMessage

public void deleteMessage(DeleteMessageRequest deleteMessageRequest)
                   throws AmazonServiceException,
                          AmazonClientException
Specified by:
deleteMessage in interface AmazonSQS
Parameters:
deleteMessageRequest - Container for the necessary parameters to execute the DeleteMessage service method on AmazonSQS.
Throws:
ReceiptHandleIsInvalidException
InvalidIdFormatException
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

listQueues

public ListQueuesResult listQueues()
                            throws AmazonServiceException,
                                   AmazonClientException
Specified by:
listQueues in interface AmazonSQS
Returns:
The response from the ListQueues service method, as returned by AmazonSQS.
Throws:
AmazonClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available.
AmazonServiceException - If an error response is returned by AmazonSQS indicating either a problem with the data in the request, or a server side issue.

setEndpoint

public void setEndpoint(String endpoint,
                        String serviceName,
                        String regionId)
                 throws IllegalArgumentException
Overrides the default endpoint for this client ("sqs.us-east-1.amazonaws.com") and explicitly provides an AWS region ID and AWS service name to use when the client calculates a signature for requests. In almost all cases, this region ID and service name are automatically determined from the endpoint, and callers should use the simpler one-argument form of setEndpoint instead of this method.

This method is not threadsafe. Endpoints should be configured when the client is created and before any service requests are made. Changing it afterwards creates inevitable race conditions for any service requests in transit.

Callers can pass in just the endpoint (ex: "sqs.us-east-1.amazonaws.com") or a full URL, including the protocol (ex: "sqs.us-east-1.amazonaws.com"). If the protocol is not specified here, the default protocol from this client's ClientConfiguration will be used, which by default is HTTPS.

For more information on using AWS regions with the AWS SDK for Java, and a complete list of all available endpoints for all AWS services, see: http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912

Parameters:
endpoint - The endpoint (ex: "sqs.us-east-1.amazonaws.com") or a full URL, including the protocol (ex: "sqs.us-east-1.amazonaws.com") of the region specific AWS endpoint this client will communicate with.
serviceName - The name of the AWS service to use when signing requests.
regionId - The ID of the region in which this service resides.
Throws:
IllegalArgumentException - If any problems are detected with the specified endpoint.

getCachedResponseMetadata

public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request)
Returns additional metadata for a previously executed successful, request, typically used for debugging issues where a service isn't acting as expected. This data isn't considered part of the result data returned by an operation, so it's available through this separate, diagnostic interface.

Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic information for an executed request, you should use this method to retrieve it as soon as possible after executing the request.

Specified by:
getCachedResponseMetadata in interface AmazonSQS
Parameters:
request - The originally executed request
Returns:
The response metadata for the specified request, or null if none is available.


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.