jeanouii commented on code in PR #1621:
URL: https://github.com/apache/activemq/pull/1621#discussion_r2709834012


##########
activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java:
##########
@@ -565,13 +565,26 @@ public void testAckMessageWithNoId() throws Exception {
                      received.getHeaders().get("message-id") + "\n\n" + 
Stomp.NULL;
         stompConnection.sendFrame(ack);
 
-        StompFrame error = stompConnection.receive();
-        LOG.info("Received Frame: {}", error);
-        assertTrue("Expected ERROR but got: " + error.getAction(), 
error.getAction().equals("ERROR"));
-
+        // Unsubscribe immediately after invalid ACK to prevent message 
redelivery
+        // while waiting for ERROR frame. This avoids race condition where 
message
+        // could be redelivered before ERROR is received.
         String unsub = "UNSUBSCRIBE\n" + "destination:/queue/" + 
getQueueName() + "\n" +
                        "id:12345\n\n" + Stomp.NULL;
         stompConnection.sendFrame(unsub);
+
+        // Receive frames until we get the ERROR frame, ignoring any MESSAGE 
frames
+        // that arrive due to redelivery (especially relevant for SSL 
transport)
+        StompFrame error = null;
+        for (int i = 0; i < 5; i++) {
+            error = stompConnection.receive();

Review Comment:
   correct. Applied!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to