Skip to content

Commit 54d98cc

Browse files
tsotnikovacogoluegnes
authored andcommitted
Fix recovery channel metrics that are sent with realTag without offset
1 parent d645b84 commit 54d98cc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/main/java/com/rabbitmq/client/impl/ChannelN.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public class ChannelN extends AMQChannel implements com.rabbitmq.client.Channel
9393
/** Whether any nacks have been received since the last waitForConfirms(). */
9494
private volatile boolean onlyAcksReceived = true;
9595

96-
private final MetricsCollector metricsCollector;
96+
protected final MetricsCollector metricsCollector;
9797

9898
/**
9999
* Construct a new channel on the given connection with the given

src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.rabbitmq.client.impl.AMQImpl;
2323
import com.rabbitmq.client.impl.ChannelN;
2424
import com.rabbitmq.client.impl.ConsumerWorkService;
25+
import com.rabbitmq.client.impl.AMQImpl.Basic;
2526

2627
import java.io.IOException;
2728

@@ -86,7 +87,8 @@ public void basicAck(long deliveryTag, boolean multiple) throws IOException {
8687
long realTag = deliveryTag - activeDeliveryTagOffset;
8788
// 0 tag means ack all
8889
if (realTag >= 0) {
89-
super.basicAck(realTag, multiple);
90+
transmit(new Basic.Ack(deliveryTag, multiple));
91+
metricsCollector.basicAck(this, deliveryTag, multiple);
9092
}
9193
}
9294

@@ -96,15 +98,17 @@ public void basicNack(long deliveryTag, boolean multiple, boolean requeue) throw
9698
long realTag = deliveryTag - activeDeliveryTagOffset;
9799
// 0 tag means nack all
98100
if (realTag >= 0) {
99-
super.basicNack(realTag, multiple, requeue);
101+
transmit(new Basic.Nack(realTag, multiple, requeue));
102+
metricsCollector.basicNack(this, deliveryTag);
100103
}
101104
}
102105

103106
@Override
104107
public void basicReject(long deliveryTag, boolean requeue) throws IOException {
105108
long realTag = deliveryTag - activeDeliveryTagOffset;
106109
if (realTag > 0) {
107-
super.basicReject(realTag, requeue);
110+
transmit(new Basic.Reject(realTag, requeue));
111+
metricsCollector.basicReject(this, deliveryTag);
108112
}
109113
}
110114

0 commit comments

Comments
 (0)