I am using spring boot version 1.3.2. I am using @JmsListener to consume message from activemq for the message that I created/produced using JmsTemplate. Here is the code:
@JmsListener(destination = "myqueue")
public void consumeMsg(Object requestBody)
try {
javaMailSender.send(requestBody);
} catch (MailException ex) {
LOG.error(ex.getLocalizedMessage(), ex);
if(ex.getMessage().contains(SMTP_CONNECTION_FAILURE) && activeMqMsg.getIntProperty("RETRYCOUNT") == 1) {
producer.send("myqueue",requestBody)
}
else {
producer.send("manualqueue",requestBody)
}
}
}
now when there is a connection failure error from smtp, I want to pause the @JmsListener for SOME time and start again to consume the message. I have not seen a better example for this use case using @JmsListener. Since I am using spring boot, I have added activemq connection parameters in application properties, I do not need to write any code to create connection factory, setting queue...etc can you help out how to do this?