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

The following examples show how to use com.amazonaws.services.sqs.model.PurgeQueueRequest. 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: ApplicationTest.java    From examples with Apache License 2.0 5 votes vote down vote up
private void writeMsg(String[] msgs)
{
  CreateQueueResult res = sqs.createQueue(currentQueueName);

  currentQueueUrl = res.getQueueUrl();

  // we should purge the queue first
  PurgeQueueRequest purgeReq = new PurgeQueueRequest(currentQueueUrl);
  sqs.purgeQueue(purgeReq);
  for (String text : msgs) {
    sqs.sendMessage(currentQueueUrl, text);
  }
}
 
Example #2
Source File: SQSTestBase.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
public void produceMsg(String[] msgs, boolean purgeFirst) throws Exception
{
  CreateQueueResult res = sqs.createQueue(getCurrentQueueName());
  if (purgeFirst) {
    PurgeQueueRequest purgeReq = new PurgeQueueRequest(res.getQueueUrl());
    sqs.purgeQueue(purgeReq);
  }
  for (String text : msgs) {
    sqs.sendMessage(res.getQueueUrl(), text);
  }
}
 
Example #3
Source File: SpringCloudSQSLiveTest.java    From tutorials with MIT License 5 votes vote down vote up
@AfterClass
public static void cleanupAwsResources() {
    AmazonSQS amazonSQS = SpringCloudAwsTestUtil.amazonSQS();
    PurgeQueueRequest receiveQueuePurge = new PurgeQueueRequest(receiveQueueUrl);
    amazonSQS.purgeQueue(receiveQueuePurge);
    amazonSQS.deleteQueue(receiveQueueUrl);

    PurgeQueueRequest sendQueuePurge = new PurgeQueueRequest(sendQueueURl);
    amazonSQS.purgeQueue(sendQueuePurge);
    amazonSQS.deleteQueue(sendQueueURl);
}
 
Example #4
Source File: AbstractAmazonSQSClientWrapper.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
@Override
public PurgeQueueResult purgeQueue(PurgeQueueRequest request) {
    request.getRequestClientOptions().appendUserAgent(userAgent);
    return amazonSqsToBeExtended.purgeQueue(request);
}
 
Example #5
Source File: AbstractAmazonSQSClientWrapperTest.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
@Test
public void purgeQueue() {
    assertWrappedMethod(AmazonSQS::purgeQueue, new PurgeQueueRequest());
}
 
Example #6
Source File: AmazonSQSRule.java    From zipkin-aws with Apache License 2.0 4 votes vote down vote up
@Override
protected void before() {
  if (client != null && queueUrl != null) {
    client.purgeQueue(new PurgeQueueRequest(queueUrl));
  }
}
 
Example #7
Source File: AmazonSQSExtendedClient.java    From amazon-sqs-java-extended-client-lib with Apache License 2.0 3 votes vote down vote up
/**
    * <p>
    * Deletes the messages in a queue specified by the <b>queue URL</b> .
    * </p>
    * <p>
    * <b>IMPORTANT:</b>When you use the PurgeQueue API, the deleted messages in
    * the queue cannot be retrieved.
    * </p>
    * <p>
    * <b>IMPORTANT:</b> This does not delete the message payloads from Amazon S3.
    * </p>
    * <p>
    * When you purge a queue, the message deletion process takes up to 60
    * seconds. All messages sent to the queue before calling
    * <code>PurgeQueue</code> will be deleted; messages sent to the queue while
    * it is being purged may be deleted. While the queue is being purged,
    * messages sent to the queue before <code>PurgeQueue</code> was called may
    * be received, but will be deleted within the next minute.
    * </p>
    *
    * @param purgeQueueRequest
    *            Container for the necessary parameters to execute the
    *            PurgeQueue service method on AmazonSQS.
    * @return The response from the PurgeQueue 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 PurgeQueueResult purgeQueue(PurgeQueueRequest purgeQueueRequest)
		throws AmazonServiceException, AmazonClientException {
	LOG.warn("Calling purgeQueue deletes SQS messages without deleting their payload from S3.");

	if (purgeQueueRequest == null) {
		String errorMessage = "purgeQueueRequest cannot be null.";
		LOG.error(errorMessage);
		throw new AmazonClientException(errorMessage);
	}

	purgeQueueRequest.getRequestClientOptions().appendUserAgent(SQSExtendedClientConstants.USER_AGENT_HEADER);

	return super.purgeQueue(purgeQueueRequest);
}
 
Example #8
Source File: AmazonSQSExtendedClientBase.java    From amazon-sqs-java-extended-client-lib with Apache License 2.0 1 votes vote down vote up
/**
 * <p>
 * Deletes the messages in a queue specified by the <b>queue URL</b> .
 * </p>
 * <p>
 * <b>IMPORTANT:</b>When you use the PurgeQueue API, the deleted messages in
 * the queue cannot be retrieved.
 * </p>
 * <p>
 * When you purge a queue, the message deletion process takes up to 60
 * seconds. All messages sent to the queue before calling
 * <code>PurgeQueue</code> will be deleted; messages sent to the queue while
 * it is being purged may be deleted. While the queue is being purged,
 * messages sent to the queue before <code>PurgeQueue</code> was called may
 * be received, but will be deleted within the next minute.
 * </p>
 *
 * @param purgeQueueRequest
 *            Container for the necessary parameters to execute the
 *            PurgeQueue service method on AmazonSQS.
 * 
 * 
 * @throws PurgeQueueInProgressException
 * @throws QueueDoesNotExistException
 *
 * @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 PurgeQueueResult purgeQueue(PurgeQueueRequest purgeQueueRequest)
		throws AmazonServiceException, AmazonClientException {

	return amazonSqsToBeExtended.purgeQueue(purgeQueueRequest);

}