Skip to content

Handle realTag = 0 in RecoveryAwareChannelN #397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2018
Merged
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 @@ -84,21 +84,27 @@ private AMQImpl.Basic.Deliver offsetDeliveryTag(AMQImpl.Basic.Deliver method) {
@Override
public void basicAck(long deliveryTag, boolean multiple) throws IOException {
long realTag = deliveryTag - activeDeliveryTagOffset;
// 0 tag means ack all when multiple is set
if (realTag > 0 || (multiple && realTag == 0)) {
transmit(new Basic.Ack(realTag, multiple));
metricsCollector.basicAck(this, deliveryTag, multiple);
if(multiple && deliveryTag == 0) {
// 0 tag means ack all when multiple is set
realTag = 0;
} else if(realTag <= 0) {
return;
}
transmit(new Basic.Ack(realTag, multiple));
metricsCollector.basicAck(this, deliveryTag, multiple);
}

@Override
public void basicNack(long deliveryTag, boolean multiple, boolean requeue) throws IOException {
long realTag = deliveryTag - activeDeliveryTagOffset;
// 0 tag means nack all when multiple is set
if (realTag > 0 || (multiple && realTag == 0)) {
transmit(new Basic.Nack(realTag, multiple, requeue));
metricsCollector.basicNack(this, deliveryTag);
if(multiple && deliveryTag == 0) {
// 0 tag means nack all when multiple is set
realTag = 0;
} else if(realTag <= 0) {
return;
}
transmit(new Basic.Nack(realTag, multiple, requeue));
metricsCollector.basicNack(this, deliveryTag);
}

@Override
Expand Down