From 779f47118804418f635cb3c478d5a5e55cac6f3c Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Wed, 13 Nov 2024 22:19:09 -0500 Subject: [PATCH] ARTEMIS-5155 Send of AMQP large messages should close the LargeMessageReader before proceeding with the message delivery This is fixing LargeMessageInterruptTest --- .../amqp/proton/ProtonAbstractReceiver.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonAbstractReceiver.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonAbstractReceiver.java index 188eb9eec07..bbae62adc77 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonAbstractReceiver.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonAbstractReceiver.java @@ -345,25 +345,23 @@ public void onMessageComplete(Delivery delivery, Message message, DeliveryAnnotations deliveryAnnotations) { connection.requireInHandler(); - try { - receiver.advance(); - - Transaction tx = null; - if (delivery.getRemoteState() instanceof TransactionalState) { - TransactionalState txState = (TransactionalState) delivery.getRemoteState(); - try { - tx = this.sessionSPI.getTransaction(txState.getTxnId(), false); - } catch (Exception e) { - this.onExceptionWhileReading(e); - } - } + receiver.advance(); - actualDelivery(message, delivery, deliveryAnnotations, receiver, tx); - } finally { - // reader is complete, we give it up now - this.messageReader.close(); - this.messageReader = null; + Transaction tx = null; + if (delivery.getRemoteState() instanceof TransactionalState) { + TransactionalState txState = (TransactionalState) delivery.getRemoteState(); + try { + tx = this.sessionSPI.getTransaction(txState.getTxnId(), false); + } catch (Exception e) { + this.onExceptionWhileReading(e); + } } + + // messageReader.close should be called before the delivery, to signal the reader is complete. + this.messageReader.close(); + this.messageReader = null; + + actualDelivery(message, delivery, deliveryAnnotations, receiver, tx); } @Override