I'm using Weblogic 12, and I've got a non-transacted asynchronous JMS consumer.
I haven't setup the ack mode so it defaults to AUTO_ACKNOWLEDGE. I've confirmed
this in the application.. see below.
What I have done is to consume the message and then call exit to quit.
I would expect that the JMS message would be on the queue after this consumer has
run as the message should not be acknowledged until such time as the onMessage has fully completed.
Instead the message no longer exists on the Weblogic JMS queue.
Any ideas why not???
See below for my onMessage code and the output from the application.
Thanks for the help.
Here is my code
@Override
public void onMessage(Message message, Session session) throws JMSException {
logger.info("Session : Ack Mode : " + convertSamToString(session.getAcknowledgeMode()));
logger.info("Session : Transacted? : " + session.getTransacted());
try {
String msgText;
if (message instanceof TextMessage) {
msgText = ((TextMessage) message).getText();
} else {
msgText = message.toString();
messages.add(msgText);
}
logger.info("<Msg_Receiver> [" + msgText + "]");
if (true)
System.exit(2);
// throw new RuntimeException("Exception during message consumption.");
} catch (JMSException jmsEx) {
logger.error("JMS Exception: ", jmsEx);
throw new RuntimeException(jmsEx);
}
logger.info("Finished processing message.");
}
Here is the output:
19 Nov 2013 16:24:26,079 INFO JmsConsumerApp - JmsConsumerApp starting.
19 Nov 2013 16:24:26,125 INFO ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@19616c7: startup date [Tue Nov 19 16:24:26 GMT 2013]; root of context hierarchy
19 Nov 2013 16:24:26,172 INFO XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [jmsConsumer-applicationContext.xml]
19 Nov 2013 16:24:26,360 INFO PropertyPlaceholderConfigurer - Loading properties file from class path resource [jms.properties]
19 Nov 2013 16:24:26,360 INFO DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@8acf6e: defining beans [org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor#0,jmsconfig,jndiTemplate,connectionFactory,jmsTransactionManager,paymentQueue,jmsConsumer,jmsConsumer1,jmsProducerListenerContainer1]; root of factory hierarchy
19 Nov 2013 16:24:26,750 INFO DefaultLifecycleProcessor - Starting beans in phase 2147483647
19 Nov 2013 16:26:22,433 INFO JmsMessageConsumer1 - Session : Ack Mode : AUTO_ACKNOWLEDGE
19 Nov 2013 16:26:22,433 INFO JmsMessageConsumer1 - Session : Transacted? : false
19 Nov 2013 16:26:22,433 INFO JmsMessageConsumer1 - <Msg_Receiver> [MyJMStestMessage]