@ Override public void action ( String queueUrl , List < String > receiptHandles ) throws JMSException { if ( receiptHandles == null || receiptHandles . isEmpty ( ) ) { return ; } List < ChangeMessageVisibilityBatchRequestEntry > nackEntries = new ArrayList < ChangeMessageVisibilityBatchRequestEntry > ( receiptHandles . size ( ) ) ; int batchId = 0 ; for ( String messageReceiptHandle : receiptHandles ) { ChangeMessageVisibilityBatchRequestEntry changeMessageVisibilityBatchRequestEntry = new ChangeMessageVisibilityBatchRequestEntry ( Integer . toString ( batchId ) , messageReceiptHandle ) . withVisibilityTimeout ( NACK_TIMEOUT ) ; nackEntries . add ( changeMessageVisibilityBatchRequestEntry ) ; batchId ++ ; } amazonSQSClient . changeMessageVisibilityBatch ( new ChangeMessageVisibilityBatchRequest ( queueUrl , nackEntries ) ) ; }
Action call block for negative acknowledge for the list of receipt handles . This action can be applied on multiple messages for the same queue .