Skip to content

Commit

Permalink
Consumer received duplicated deplayed messages upon restart
Browse files Browse the repository at this point in the history
Fix when send a delayed message ,there is a case when a consumer restarts and pull duplicate messages. #6403

(cherry picked from commit e71b9fc)
  • Loading branch information
liudezhi2098 authored and tuteng committed Apr 13, 2020
1 parent 9a8621f commit 63464ab
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,14 @@ public synchronized void readEntryFailed(ManagedLedgerException mle, Object ctx)
};

positions.stream().filter(position -> !alreadyAcknowledgedPositions.contains(position))
.forEach(p -> ledger.asyncReadEntry((PositionImpl) p, cb, ctx));
.forEach(p ->{
if (((PositionImpl) p).compareTo(this.readPosition) == 0) {
this.setReadPosition(this.readPosition.getNext());
log.warn("[{}][{}] replayPosition{} equals readPosition{}," + " need set next readPositio",
ledger.getName(), name, (PositionImpl) p, this.readPosition);
}
ledger.asyncReadEntry((PositionImpl) p, cb, ctx);
});

return alreadyAcknowledgedPositions;
}
Expand Down

0 comments on commit 63464ab

Please sign in to comment.