com.amazonaws.services.sqs.model.DeleteQueueResult Java Examples

The following examples show how to use com.amazonaws.services.sqs.model.DeleteQueueResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AWSSQSClient.java    From camel-kafka-connector with Apache License 2.0 6 votes vote down vote up
public boolean deleteQueue(String queue) {
    GetQueueUrlResult getQueueUrlResult = sqs.getQueueUrl(queue);

    if (getQueueUrlResult.getSdkHttpMetadata().getHttpStatusCode() == 404) {
        return true;
    } else {
        if (getQueueUrlResult.getSdkHttpMetadata().getHttpStatusCode() != 200) {
            LOG.warn("Unable to get queue {} for deletion", queue);

            return false;
        }
    }

    DeleteQueueResult result = sqs.deleteQueue(getQueueUrlResult.getQueueUrl());

    if (result.getSdkHttpMetadata().getHttpStatusCode() != 200) {
        LOG.warn("Unable to delete queue {}", queue);
        return false;
    }

    return true;
}
 
Example #2
Source File: AmazonSQSVirtualQueuesClient.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 5 votes vote down vote up
@Override
public DeleteQueueResult deleteQueue(DeleteQueueRequest request) {
    if (LOG.isDebugEnabled()) {
        LOG.debug(String.format("Deleting Virtual Queue is %s and Queue Name is %s", (virtualQueues.size() - 1), request.getQueueUrl()));
    }

    return getVirtualQueue(request.getQueueUrl())
            .map(virtualQueue -> virtualQueue.deleteQueue())
            .orElseGet(() -> amazonSqsToBeExtended.deleteQueue(request));
}
 
Example #3
Source File: AmazonSQSIdleQueueDeletingClient.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
@Override
public DeleteQueueResult deleteQueue(DeleteQueueRequest request) {
    DeleteQueueResult result = super.deleteQueue(request);
    queueDeleted(request.getQueueUrl());
    return result;
}
 
Example #4
Source File: AmazonSQSVirtualQueuesClient.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
public DeleteQueueResult deleteQueue() {
    virtualQueues.remove(id.getVirtualQueueName());
    receiveBuffer.shutdown();
    expireFuture.ifPresent(f -> f.cancel(false));
    return new DeleteQueueResult();
}
 
Example #5
Source File: AbstractAmazonSQSClientWrapper.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
@Override
public DeleteQueueResult deleteQueue(DeleteQueueRequest request) {
    request.getRequestClientOptions().appendUserAgent(userAgent);
    return amazonSqsToBeExtended.deleteQueue(request);
}
 
Example #6
Source File: MockSQS.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
@Override
public DeleteQueueResult deleteQueue(DeleteQueueRequest request) {
    queues.remove(getQueue(request.getQueueUrl()).getQueueName());
    return new DeleteQueueResult();
}
 
Example #7
Source File: AmazonSQSExtendedClientBase.java    From amazon-sqs-java-extended-client-lib with Apache License 2.0 2 votes vote down vote up
/**
 * <p>
 * Deletes the queue specified by the <b>queue URL</b> , regardless of
 * whether the queue is empty. If the specified queue does not exist, Amazon
 * SQS returns a successful response.
 * </p>
 * <p>
 * <b>IMPORTANT:</b> Use DeleteQueue with care; once you delete your queue,
 * any messages in the queue are no longer available.
 * </p>
 * <p>
 * When you delete a queue, the deletion process takes up to 60 seconds.
 * Requests you send involving that queue during the 60 seconds might
 * succeed. For example, a SendMessage request might succeed, but after the
 * 60 seconds, the queue and that message you sent no longer exist. Also,
 * when you delete a queue, you must wait at least 60 seconds before
 * creating a queue with the same name.
 * </p>
 * <p>
 * We reserve the right to delete queues that have had no activity for more
 * than 30 days. For more information, see <a href=
 * "http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSConcepts.html"
 * > How Amazon SQS Queues Work </a> in the <i>Amazon SQS Developer
 * Guide</i> .
 * </p>
 *
 * @param 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.
 * @throws AmazonServiceException
 *             If an error response is returned by AmazonSQS indicating
 *             either a problem with the data in the request, or a server
 *             side issue.
 */
public DeleteQueueResult deleteQueue(DeleteQueueRequest deleteQueueRequest)
		throws AmazonServiceException, AmazonClientException {

	return amazonSqsToBeExtended.deleteQueue(deleteQueueRequest);
}
 
Example #8
Source File: AmazonSQSExtendedClientBase.java    From amazon-sqs-java-extended-client-lib with Apache License 2.0 2 votes vote down vote up
/**
 * <p>
 * Deletes the queue specified by the <b>queue URL</b> , regardless of
 * whether the queue is empty. If the specified queue does not exist, Amazon
 * SQS returns a successful response.
 * </p>
 * <p>
 * <b>IMPORTANT:</b> Use DeleteQueue with care; once you delete your queue,
 * any messages in the queue are no longer available.
 * </p>
 * <p>
 * When you delete a queue, the deletion process takes up to 60 seconds.
 * Requests you send involving that queue during the 60 seconds might
 * succeed. For example, a SendMessage request might succeed, but after the
 * 60 seconds, the queue and that message you sent no longer exist. Also,
 * when you delete a queue, you must wait at least 60 seconds before
 * creating a queue with the same name.
 * </p>
 * <p>
 * We reserve the right to delete queues that have had no activity for more
 * than 30 days. For more information, see <a href=
 * "http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSConcepts.html"
 * > How Amazon SQS Queues Work </a> in the <i>Amazon SQS Developer
 * Guide</i> .
 * </p>
 * 
 * @param queueUrl
 *            The URL of the Amazon SQS queue to take action on.
 * 
 * @return The response from the DeleteQueue 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.
 * @throws AmazonServiceException
 *             If an error response is returned by AmazonSQS indicating
 *             either a problem with the data in the request, or a server
 *             side issue.
 */
public DeleteQueueResult deleteQueue(String queueUrl) throws AmazonServiceException, AmazonClientException {

	return amazonSqsToBeExtended.deleteQueue(queueUrl);
}