Package javax.jms

Examples of javax.jms.MessageConsumer.receiveNoWait()


        // only guarantee is a page size - but a snapshot of pagedinpending is
        // used so it is most likely more
        assertTrue("got at least our expected minimum in the browser: ", i > BaseDestination.MAX_PAGE_SIZE);

        assertFalse("nothing left in the browser", browserView.hasMoreElements());
        assertNull("consumer finished", consumer.receiveNoWait());
    }

    public void testBrowseClose() throws Exception {
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        ActiveMQQueue destination = new ActiveMQQueue("TEST");
View Full Code Here


        Message answer = consumer.receive(5000);
        assertNotNull("Should have received a message!", answer);
        // check if method will return at all and will return a null
        answer = consumer.receive(1);
        assertNull("Should have not received a message!", answer);
        answer = consumer.receiveNoWait();
        assertNull("Should have not received a message!", answer);
    }

    public void testIdleConsumer() throws Exception {
        doTestIdleConsumer(false);
View Full Code Here

        answer = (TextMessage)consumer.receive(5000);
        assertEquals("Should have received a message!", answer.getText(), "Msg2");
        if (transacted) {
            session.commit();
        }
        answer = (TextMessage)consumer.receiveNoWait();
        assertNull("Should have not received a message!", answer);
    }

    public void testRecvRecvCommit() throws Exception {
        doTestRecvRecvCommit(false);
View Full Code Here

        if (transacted) {
            session.commit();
        }
        // now lets receive it
        MessageConsumer consumer = session.createConsumer(queue);
        TextMessage answer = (TextMessage)consumer.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg1");
        answer = (TextMessage)consumer.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg2");
        if (transacted) {
            session.commit();
View Full Code Here

        }
        // now lets receive it
        MessageConsumer consumer = session.createConsumer(queue);
        TextMessage answer = (TextMessage)consumer.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg1");
        answer = (TextMessage)consumer.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg2");
        if (transacted) {
            session.commit();
        }
        answer = (TextMessage)consumer.receiveNoWait();
View Full Code Here

        answer = (TextMessage)consumer.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg2");
        if (transacted) {
            session.commit();
        }
        answer = (TextMessage)consumer.receiveNoWait();
        assertNull("Should have not received a message!", answer);
    }
   
    public void testTwoConsumers() throws Exception {
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

        // now lets receive it
        MessageConsumer consumer1 = session.createConsumer(queue);
        MessageConsumer consumer2 = session.createConsumer(queue);
        TextMessage answer = (TextMessage)consumer1.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg1");
        answer = (TextMessage)consumer2.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg2");

        answer = (TextMessage)consumer2.receiveNoWait();
        assertNull("Should have not received a message!", answer);
    }
View Full Code Here

        TextMessage answer = (TextMessage)consumer1.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg1");
        answer = (TextMessage)consumer2.receiveNoWait();
        assertEquals("Should have received a message!", answer.getText(), "Msg2");

        answer = (TextMessage)consumer2.receiveNoWait();
        assertNull("Should have not received a message!", answer);
    }
   
    // https://issues.apache.org/activemq/browse/AMQ-2567
    public void testManyMessageConsumer() throws Exception {
View Full Code Here

        // only guarantee is a page size - but a snapshot of pagedinpending is
        // used so it is most likely more
        assertTrue("got at least our expected minimum in the browser: ", i > BaseDestination.MAX_PAGE_SIZE);

        assertFalse("nothing left in the browser", browserView.hasMoreElements());
        assertNull("consumer finished", consumer.receiveNoWait());
    }
}
View Full Code Here

        Message message = null;
        for (int i = 0; i < 4; i++) {
            message = consumer.receive(1000);
            assertNotNull(message);
        }
        assertNull(consumer.receiveNoWait());
        message.acknowledge();
    }

    public void initCombosForTestDurableConsumerSelectorChange() {
        addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)});
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.