I am using Default Message Listener Container. I have set session transacted property true in configuration.
My onMessage()
method is this:
public void onMessage(Message message) {
try {
// Some code here
} catch (JmsException jmse) {
log.error(jmse);
} catch (Throwable t) {
log.error(t);
}
}
As you can see I am handling the exception in a catch
block.
My requirement is that if it is a JMS Exception, it should be resent, i.e. message redelivered to the listener/consumer as it happens when there is transaction rollback. How can that happen?
Can we manually rollback the transaction here? I think that is a possible solution but I dont how to do that in code.
Another generic question:
Since I am handling all the possible exceptions through a catch
block, I guess there will not be a scenario of message redelivery i.e. transaction rollback since I am handling all the possible exceptions through the catch
block. Am I right?