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);
}
}
Aggregations