Search in sources :

Example 1 with DeleteQueueRequest

use of software.amazon.awssdk.services.sqs.model.DeleteQueueRequest in project aws-doc-sdk-examples by awsdocs.

the class DeleteQueue method deleteSQSQueue.

// snippet-start:[sqs.java2.sqs_example.delete_queue]
public static void deleteSQSQueue(SqsClient sqsClient, String queueName) {
    try {
        GetQueueUrlRequest getQueueRequest = GetQueueUrlRequest.builder().queueName(queueName).build();
        String queueUrl = sqsClient.getQueueUrl(getQueueRequest).queueUrl();
        DeleteQueueRequest deleteQueueRequest = DeleteQueueRequest.builder().queueUrl(queueUrl).build();
        sqsClient.deleteQueue(deleteQueueRequest);
    } catch (SqsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : GetQueueUrlRequest(software.amazon.awssdk.services.sqs.model.GetQueueUrlRequest) DeleteQueueRequest(software.amazon.awssdk.services.sqs.model.DeleteQueueRequest) SqsException(software.amazon.awssdk.services.sqs.model.SqsException)

Aggregations

DeleteQueueRequest (software.amazon.awssdk.services.sqs.model.DeleteQueueRequest)1 GetQueueUrlRequest (software.amazon.awssdk.services.sqs.model.GetQueueUrlRequest)1 SqsException (software.amazon.awssdk.services.sqs.model.SqsException)1