8000 Revert "Pub/Sub: Add message abandonment (#4250)" by chingor13 · Pull Request #4297 · googleapis/google-cloud-java · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ public interface AckReplyConsumer {
* message.
*/
void nack();

void abandon();
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ private class AckHandler implements ApiFutureCallback<AckReply> {
private final int outstandingBytes;
private final long receivedTimeMillis;
private final Instant totalExpiration;
private boolean extending = true;

AckHandler(String ackId, int outstandingBytes, Instant totalExpiration) {
this.ackId = ackId;
Expand All @@ -152,7 +151,6 @@ private void forget() {
*/
return;
}
extending = false;
flowController.release(1, outstandingBytes);
messagesWaiter.incrementPendingMessages(-1);
processOutstandingBatches();
Expand Down Expand Up @@ -419,11 +417,6 @@ public void ack() {
public void nack() {
response.set(AckReply.NACK);
}

@Override
public void abandon() {
ackHandler.forget();
}
};
ApiFutures.addCallback(response, ackHandler, MoreExecutors.directExecutor());
executor.execute(
Expand Down Expand Up @@ -478,9 +471,6 @@ void extendDeadlines() {
Instant extendTo = now.plusSeconds(extendSeconds);

for (Map.Entry<String, AckHandler> entry : pendingMessages.entrySet()) {
if (!entry.getValue().extending) {
continue;
}
String ackId = entry.getKey();
Instant totalExpiration = entry.getValue().totalExpiration;
if (totalExpiration.isAfter(extendTo)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,6 @@ public void testNack() throws Exception {
assertThat(sentModAcks).contains(ModAckItem.of(TEST_MESSAGE.getAckId(), 0));
}

@Test
public void testAbandon() throws Exception {
dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE), NOOP_RUNNABLE);
consumers.take().abandon();
dispatcher.extendDeadlines();
assertThat(sentModAcks).doesNotContain(TEST_MESSAGE.getAckId());
}

@Test
public void testExtension() throws Exception {
dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE), NOOP_RUNNABLE);
Expand Down
0