nevado-jms/src/test/java/org/skyscreamer/nevado/jms/facilities/MessageListenerTest.java
//    Transacted Session - The next message for the listener is delivered. RuntimeException does not automatically rollback the session, and the client must do it explicitly.
Transacted Session - The next message for the listener is delivered. RuntimeException does not automatically rollback the session, and the client must do it explicitly.
Transacted Session - The next message for the listener is delivered . RuntimeException does not automatically rollback the session and the client must do it explicitly .
@Test
    public void testThrowRuntimeAutoAck() throws JMSException, InterruptedException {
        TestMessageListenerRuntimeException messageListener = new TestMessageListenerRuntimeException(false);
        NevadoConnection connection = createConnection(getConnectionFactory());
        connection.start();
        NevadoSession session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue tempQueue = createTempQueue(session);
        MessageConsumer consumer = session.createConsumer(tempQueue);
        consumer.setMessageListener(messageListener);
        TextMessage msg1 = session.createTextMessage(RandomData.readString());
        TextMessage msg2 = session.createTextMessage(RandomData.readString());
        MessageProducer producer = session.createProducer(tempQueue);
        producer.send(msg1);
        producer.send(msg2);
        Message msgOut = messageListener.getMessage(5000);
        if (msg1.equals(messageListener.getFirstMessage()))
            Assert.assertEquals(msg1, msgOut);
        else if (msg2.equals(messageListener.getFirstMessage()))
            Assert.assertEquals(msg2, msgOut);
        else
            Assert.fail("Message did not match either sent: " + msgOut);
        connection.close();
    }
@ Test public void testThrowRuntimeAutoAck ( ) throws JMSException , InterruptedException { TestMessageListenerRuntimeException messageListener = new TestMessageListenerRuntimeException ( false ) ; NevadoConnection connection = createConnection ( getConnectionFactory ( ) ) ; connection . start ( ) ; NevadoSession session = connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; Queue tempQueue = createTempQueue ( session ) ; MessageConsumer consumer = session . createConsumer ( tempQueue ) ; consumer . setMessageListener ( messageListener ) ; TextMessage msg1 = session . createTextMessage ( RandomData . readString ( ) ) ; TextMessage msg2 = session . createTextMessage ( RandomData . readString ( ) ) ; MessageProducer producer = session . createProducer ( tempQueue ) ; producer . send ( msg1 ) ; producer . send ( msg2 ) ; Message msgOut = messageListener . getMessage ( 5000 ) ; if ( msg1 . equals ( messageListener . getFirstMessage ( ) ) ) Assert . assertEquals ( msg1 , msgOut ) ; else if ( msg2 . equals ( messageListener . getFirstMessage ( ) ) ) Assert . assertEquals ( msg2 , msgOut ) ; else Assert . fail ( "Message did not match either sent: " + msgOut ) ; connection . close ( ) ; }
Transacted Session - The next message for the listener is delivered.
Transacted Session - The next message for the listener is delivered .