Problem with Poison Message Driven Bean


EJB design: Problem with Poison Message Driven Bean

  1. Problem with Poison Message Driven Bean (4 messages)

    Hi, I've a problem with an application running on Wls 6.1. There is a simple container-managed transaction (transaction value "NotSupported") mdb that consumes a message (from a queue). Unfortunatly it seems that the message is continually retrasmitted by the JMS destination to consumer! Can you help me? Is cmt-mdb the right way to perform a publish-subscribe operation? Can you tell me suggestions about it???
    I'm sure that the mdb doesn't throw any system exceptions (so it should be sent the message acknowledgement ).

    thank you very much!
    Mark (from Italy)
  2. Check if the message is being consumed. If, for some reason, the code which consumes the message throws an exception, the message would still be on the queue and it would seem as if the message is being transmitted again. This would be an endless loop. So, you gotto make sure that all your possible exceptions are handled properly.

    Hope this helps.
  3. Use Bean Managed Transaction (BMT).
    Message consumption and acknowledgement are not part of
    part of transaction in case of BMT.

  4. Your MDB onMessage() method implementation must be throwing some exception which is not getting caught in the onMessage method. Just attach a catch (Throwable t) clause and check for the exception that is being thrown and try to recover from it. In case of any uncaught exceptions, the MDB runs in an infinite loop and especiually if yur MDB is CMT enabled.

    Hope this helps

  5. Thank you all for your inputs!!