Skip to content

Commit

Permalink
DBZ-8236 Adjusted committer.markProcessed(record) to only execute aft…
Browse files Browse the repository at this point in the history
…er confirmed receipt of published messages by Pubsub
  • Loading branch information
nathan-smit-1 authored and jpechane committed Sep 26, 2024
1 parent 949c394 commit 4d50b7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
PubsubMessage message = buildPubSubMessage(record);

deliveries.add(publisher.publish(message));

committer.markProcessed(record);
}
List<String> messageIds;
try {
Expand All @@ -276,6 +274,12 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
throw new DebeziumException(e);
}
LOGGER.trace("Sent messages with ids: {}", messageIds);

// Once publishing is confirmed, mark all records as processed
for (ChangeEvent<Object, Object> record : records) {
committer.markProcessed(record);
}

committer.markBatchFinished();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
PubsubMessage message = buildPubSubMessage(record);

deliveries.add(publisher.publish(message));
committer.markProcessed(record);
}
List<String> messageIds;
try {
Expand All @@ -142,6 +141,12 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
throw new DebeziumException(e);
}
LOGGER.trace("Sent messages with ids: {}", messageIds);

// Once publishing is confirmed, mark all records as processed
for (ChangeEvent<Object, Object> record : records) {
committer.markProcessed(record);
}

committer.markBatchFinished();
}

Expand Down

0 comments on commit 4d50b7a

Please sign in to comment.