Hello there! I have an MDB which peforms some database related logic on its onMessage() method. If something bad happens, I'd like to rollback the transaction so nothing is persisted (I'm using hibernate). But when I do this:
It seems that the message receive is not acknowledge, and then the container ends up in an infinite loop trying to consume the message every time. What I'd like to happen is, on error, the message should be purged from the queue?
PS: Didn't put all the code and descriptors here, to let the msg clean. If required to help please let me know.
Typically, you want the commit of the message and DB to happen at the same time. You can do a rollback, and the second time around, ignore the message. You can do this by keeping a hash table by message ID in your MDB of messages to subsequently ignore.