Search in sources :

Example 1 with SpringConsumer

use of org.apache.activemq.spring.SpringConsumer in project activemq-artemis by apache.

the class ZeroPrefetchConsumerTest method testCannotUseMessageListener.

public void testCannotUseMessageListener() throws Exception {
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = session.createConsumer(queue);
    MessageListener listener = new SpringConsumer();
    try {
        consumer.setMessageListener(listener);
        fail("Should have thrown JMSException as we cannot use MessageListener with zero prefetch");
    } catch (JMSException e) {
        LOG.info("Received expected exception : " + e);
    }
}
Also used : MessageConsumer(javax.jms.MessageConsumer) MessageListener(javax.jms.MessageListener) JMSException(javax.jms.JMSException) SpringConsumer(org.apache.activemq.spring.SpringConsumer) Session(javax.jms.Session)

Example 2 with SpringConsumer

use of org.apache.activemq.spring.SpringConsumer in project activemq by apache.

the class ZeroPrefetchConsumerTest method testCannotUseMessageListener.

public void testCannotUseMessageListener() throws Exception {
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = session.createConsumer(queue);
    MessageListener listener = new SpringConsumer();
    try {
        consumer.setMessageListener(listener);
        fail("Should have thrown JMSException as we cannot use MessageListener with zero prefetch");
    } catch (JMSException e) {
        LOG.info("Received expected exception : " + e);
    }
}
Also used : MessageConsumer(javax.jms.MessageConsumer) MessageListener(javax.jms.MessageListener) JMSException(javax.jms.JMSException) SpringConsumer(org.apache.activemq.spring.SpringConsumer) Session(javax.jms.Session)

Aggregations

JMSException (javax.jms.JMSException)2 MessageConsumer (javax.jms.MessageConsumer)2 MessageListener (javax.jms.MessageListener)2 Session (javax.jms.Session)2 SpringConsumer (org.apache.activemq.spring.SpringConsumer)2