@@ -84,21 +84,27 @@ private AMQImpl.Basic.Deliver offsetDeliveryTag(AMQImpl.Basic.Deliver method) {
8484 @ Override
8585 public void basicAck (long deliveryTag , boolean multiple ) throws IOException {
8686 long realTag = deliveryTag - activeDeliveryTagOffset ;
87- // 0 tag means ack all when multiple is set
88- if (realTag > 0 || (multiple && realTag == 0 )) {
89- transmit (new Basic .Ack (realTag , multiple ));
90- metricsCollector .basicAck (this , deliveryTag , multiple );
87+ if (multiple && deliveryTag == 0 ) {
88+ // 0 tag means ack all when multiple is set
89+ realTag = 0 ;
90+ } else if (realTag <= 0 ) {
91+ return ;
9192 }
93+ transmit (new Basic .Ack (realTag , multiple ));
94+ metricsCollector .basicAck (this , deliveryTag , multiple );
9295 }
9396
9497 @ Override
9598 public void basicNack (long deliveryTag , boolean multiple , boolean requeue ) throws IOException {
9699 long realTag = deliveryTag - activeDeliveryTagOffset ;
97- // 0 tag means nack all when multiple is set
98- if (realTag > 0 || (multiple && realTag == 0 )) {
99- transmit (new Basic .Nack (realTag , multiple , requeue ));
100- metricsCollector .basicNack (this , deliveryTag );
100+ if (multiple && deliveryTag == 0 ) {
101+ // 0 tag means nack all when multiple is set
102+ realTag = 0 ;
103+ } else if (realTag <= 0 ) {
104+ return ;
101105 }
106+ transmit (new Basic .Nack (realTag , multiple , requeue ));
107+ metricsCollector .basicNack (this , deliveryTag );
102108 }
103109
104110 @ Override
0 commit comments