You can process the message and database updates under the same transaction. This is what the message.getJMSRedelivered() method call is for. You can check this flag prior to doing any other work on the message. If it is set, that means that your application has seen this message before and had backed out the transaction. You can then process this message as an exception of some sort.
-----Original Message----- From: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED] Behalf Of Tong Wang Sent: Thursday, December 30, 2004 12:05 PM To: EJB-INTEREST@JAVA.SUN.COM Subject: handle poison message in MDB Have you encountered the situation when you want to abort database transactions but commit the JMS in Message Driven Bean (MDB) in order to avoid poision message? If the message is bad, and some database updates have already been done before we detected message is bad, we don't want to commit those database changes. On the other hand, we want to commit JMS to remove the message off the queue. That means we can't put JMS and DB in the same global transaction. Is this the best way to handle poison message? Thanks Tong =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". The information contained in this e-mail may be confidential and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorized. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator.(A) =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".