我正在使用Spring SimpleMessageListenerConatiner,其中确认模式为2(客户端确认),而Queue是Solace .
当我从单元测试中抛出运行时异常时,意味着独立的spring配置,消息重新发送没有任何问题,但是当我在JBOSS中部署我的应用程序时,相同的代码不起作用 .
公共类MyListener实现MessageListener {public void onMessage(Message message){
try {
throw new ConnectionException("Error in Connection");
} catch (ConnectionException e) {
LOGGER.error("Throwing exception...");
throw new MyRuntimeException("Throwing exception");
} finally {
LOGGER.info("Done...");
}
}
Spring config is:
<bean id="solaceMessageListener" class="org.springframework.jms.listener.SimpleMessageListenerContainer">
<property name="connectionFactory" ref="solaceConnectionFactory"/>
<property name="destinationName" value="QueueName"/>
<property name="messageListener" ref="myListener"/>
<property name="concurrency" value="1"/>
<property name="destinationResolver" ref="destinationResolver" />
<property name="sessionAcknowledgeMode" value="2"/>
</bean>
Constaint:1 . 我不能使用DefaultMessageListenerContainer 2. Session Transacted true工作但我们不能使用它 .