Package com.amazonaws.services.sqs.model

Examples of com.amazonaws.services.sqs.model.DeleteMessageRequest


       
        logger.info("event=deleting_message receipt_handle=" + msg.getReceiptHandle());

        messageBodies.add(msg.getBody());
       
        DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest();
        deleteMessageRequest.setQueueUrl(queueUrl);
        deleteMessageRequest.setReceiptHandle(msg.getReceiptHandle());
 
        start = System.currentTimeMillis();
        //logger.info("event=DEL_START");
        cqs1.deleteMessage(deleteMessageRequest);
        //logger.info("event=DEL_END");
View Full Code Here


          if (receiveMessageResult.getMessages().size() == 1) {
            assertTrue("wrong message content", receiveMessageResult.getMessages().get(0).getBody().equals(message));
            long durationSec = (System.currentTimeMillis() - start)/1000;
            logger.info("message found again after " + durationSec + " sec");
            DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest();
            deleteMessageRequest.setQueueUrl(queueUrl);
            deleteMessageRequest.setReceiptHandle(receiveMessageResult.getMessages().get(0).getReceiptHandle());
            cqs1.deleteMessage(deleteMessageRequest);
            logger.info("deleted message");
            assertTrue("message became visible already after " + durationSec + " sec", durationSec >= expectedDelaySeconds);
            break;
          }
View Full Code Here

    private static class MessageReceiver implements Runnable {
     
      private void deleteMessage(String receiptHandle) {
      try {
        long start = System.currentTimeMillis();
        DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest();
        deleteMessageRequest.setQueueUrl(queueUrl);
        deleteMessageRequest.setReceiptHandle(receiptHandle);
        cqs1.deleteMessage(deleteMessageRequest);
        long end = System.currentTimeMillis();
        deleteSuccessCount.incrementAndGet();
        logger.info("event=delete rt="+(end-start)+" receipt_handle=" + receiptHandle + " success_count=" + deleteSuccessCount.get() + " failure_count=" + deleteFailureCount);
      } catch (Exception ex) {
View Full Code Here

        ReceiveMessageResult receiveMessageResult = cqs1.receiveMessage(receiveMessageRequest);

        count += receiveMessageResult.getMessages().size();
       
        for (Message msg : receiveMessageResult.getMessages()) {
          DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest(queueUrl, msg.getReceiptHandle());
          cqs1.deleteMessage(deleteMessageRequest);
        }

        if (count >=1000) {
          break;
View Full Code Here

        ReceiveMessageResult receiveMessageResult = cqs1.receiveMessage(receiveMessageRequest);

        count += receiveMessageResult.getMessages().size();
       
        for (Message msg : receiveMessageResult.getMessages()) {
          DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest(queueUrl, msg.getReceiptHandle());
          cqs1.deleteMessage(deleteMessageRequest);
        }
       
        if (count > 1) {
          fail("expected 1 message but found " + count);
View Full Code Here

        ReceiveMessageResult receiveMessageResult = cqs1.receiveMessage(receiveMessageRequest);

        count += receiveMessageResult.getMessages().size();
       
        for (Message msg : receiveMessageResult.getMessages()) {
          DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest(queueUrl, msg.getReceiptHandle());
          cqs1.deleteMessage(deleteMessageRequest);
        }
       
        if (count > 10) {
          fail("expected 1 message but found " + count);
View Full Code Here

     
    } else if (parameters.containsKey("Delete")) {
     
      try {
       
        DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest(queueUrl, receiptHandle);
        sqs.deleteMessage(deleteMessageRequest);
        logger.debug("event=delete_message queue_url= " + queueUrl + " receipt_handle=" + receiptHandle);
     
      } catch (Exception ex) {
        logger.error("event=delete_message queue_url= " + queueUrl + " receipt_handle=" + receiptHandle, ex);
View Full Code Here

    }

    @Override
    public void closeTask(QSTaskModel task) {
        String receiptHandle = receiptHandles.remove(task);
        sqs.deleteMessage(new DeleteMessageRequest(queueUrl, receiptHandle));
    }
View Full Code Here

  public String acknowlegdeReceipt(Message<?> message) {
    String receiptHandle = (String) message.getHeaders().get(
        SqsHeaders.MSG_RECEIPT_HANDLE);
    if (sqsClient != null && receiptHandle != null
        && !receiptHandle.isEmpty()) {
      sqsClient.deleteMessage(new DeleteMessageRequest(queueUrl,
          receiptHandle));
    }

    return receiptHandle;
  }
View Full Code Here

        receiveReq.setMaxNumberOfMessages(MAX_MESSAGES);
        List<Message> list = client().receiveMessage(receiveReq).getMessages();

        if (list != null && !list.isEmpty()) {
          Message message = list.get(0);
          client().deleteMessage(new DeleteMessageRequest(url, message.getReceiptHandle()));
          task = message.getBody();
        }
      } catch (AmazonServiceException ase) {
        logException(ase);
      } catch (AmazonClientException ace) {
View Full Code Here

TOP

Related Classes of com.amazonaws.services.sqs.model.DeleteMessageRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.