activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mjustin <michael.jus...@gmx.net>
Subject Test for Stomp AutoAcknoledge
Date Sat, 21 Mar 2009 10:29:38 GMT

Hi,

This test (based on StompTest.java in the
org.apache.activemq.transport.stomp package) fails on the fifth message. It
first sends ten messages to a queue and then subscribes ten times in a loop
to read one message.

I am not sure if it has something to do with maximumRedeliveries, but since
the default value for maximumRedeliveries is 6, I guess this might be the
reason, and this behaviour is correct?

    public void testSubscribeWithAutoAck() throws Exception {

        for (int i = 0; i < 10; i++) {
            sendMessage(getName());
        }

        for (int i = 0; i < 10; i++) {
            stompConnection = new StompConnection();
            stompConnect();

            String frame = "CONNECT\n" + "login: system\n" + "passcode:
manager\n\n" + Stomp.NULL;
            stompConnection.sendFrame(frame);

            frame = stompConnection.receiveFrame();
            assertTrue(frame.startsWith("CONNECTED"));

            frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() +
"\n" + "ack:auto\n\n" + Stomp.NULL;
            stompConnection.sendFrame(frame);

            try {
                frame = stompConnection.receiveFrame(2000);
                assertTrue("Message " + i, frame.startsWith("MESSAGE"));
            } catch (SocketTimeoutException ex) {
                fail(ex.getMessage() + " at Message " + i);
            }

            frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
            stompConnection.sendFrame(frame);

            stompDisconnect();
        }

    }
-- 
View this message in context: http://www.nabble.com/Test-for-Stomp-AutoAcknoledge-tp22634591p22634591.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message