Discussions

EJB design: Error Logging to a table in MDB's with CMT???

  1. Error Logging to a table in MDB's with CMT??? (3 messages)

    HI-

    I have a need to log errors to a table while processing inside a message driven bean. Unfortunately, this is quite difficult as the global transaction is always rolled-back.

    Is there any way to accomplish this? I could use JTA, but I lose the inclusion of the initial message read in the transaction, which is half the benefit of the CMT.

    Any ideas?
  2. Hi,
    I would consider isolating the database logging code in a session bean with 'RequiresNew' transacation attribute. Another solution would be to send a message with the errors to another MDB specialized in consuming error messages.
    Best regards, Mircea.
  3. We used the session bean approach once and found no problems with it. It's easy to set up and to use. Also, you do not have to worry about ordered delivery as you (sometimes) have to with the MDB approach.
  4. that worked[ Go to top ]

    the session bean approach works great!

    not sure if the MDB approach would work, as the sending of the JMS message should get rolled back as part of a failed transaction?