我正在使用JMS向我的SQS队列发送/接收消息,但是即使在使用client_acknowledge时出现异常,我也无法重新发送消息.怎么做到这一点?
我试过一个简单的测试,
@JmsListener(destination = "test-normalqueue")
public void receiveNormalQueue(String message)
{
try {
logger.info("message received in normal queue: " + message);
throw new NullPointerException();
} catch (Exception e) {
logger.error(LoggingUtil.getStackTrace(e));;
}
}
即使异常消息没有回到队列.
@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(getSQSConnectionFactory());
factory.setConcurrency("1-2");
factory.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
return factory;
}
最佳答案
原文链接:https://www.f2er.com/spring/437401.html