/** * BLOCKING NACK all messages which have been read from Pubsub but not passed downstream. This * way Pubsub will send them again promptly. */ public void nackAll(PubsubReader reader) throws IOException { checkState(this.reader == null, "Cannot nackAll on persisting checkpoint"); List<String> batchYetToAckIds = new ArrayList<>(Math.min(notYetReadIds.size(), ACK_BATCH_SIZE)); for (String ackId : notYetReadIds) { batchYetToAckIds.add(ackId); if (batchYetToAckIds.size() >= ACK_BATCH_SIZE) { long nowMsSinceEpoch = now(reader); reader.nackBatch(nowMsSinceEpoch, batchYetToAckIds); batchYetToAckIds.clear(); } } if (!batchYetToAckIds.isEmpty()) { long nowMsSinceEpoch = now(reader); reader.nackBatch(nowMsSinceEpoch, batchYetToAckIds); } } }