|
![]() |
According to headfirst EJB(page 460) if there is any system exception,both BMT and CMT should put the message again in topic,but in this case,it's happening only for CMT and not for BMT.
Ans I was wondering if this is will hold good for Q also.
First of all, MDB should never thrown anything else than application exceptions, i.e. no RemoteException and no RuntimeException.
The onMessage method of a message-driven bean must not throw application exceptions or the java.rmi.RemoteException.
Message-driven beans, like other well-behaved JMS MessageListeners, should not, in general, throw RuntimeExceptions.
If the bean method encounters a RuntimeException or error, it should simply propagate the error from the bean method to the Container (i.e., the bean method does not have to catch the exception).
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Message-driven beans should not attempt to use the JMS API for message acknowledgment. Message acknowledgment is automatically handled by the container. If the message-driven bean uses container managed transaction demarcation, message acknowledgment is handled automatically as a part of the transaction commit. If bean managed transaction demarcation is used, the message receipt cannot be part of the bean-managed transaction, and, in this case, the receipt is acknowledged by the container. If bean managed transaction demarcation is used, the Bean Provider can indicate in the acknowedge-mode deployment descriptor element whether JMS AUTO_ACKNOWLEDGE semantics or DUPS_OK_ACKNOWLEDGE semantics should apply. If the acknowledge-mode deployment descriptor element is not specified, JMS AUTO_ACKNOWLEDGE semantics are assumed.
Message-driven beans should not attempt to use the JMS API for message acknowledgment. Message acknowledgment is automatically handled by the container. If the message-driven bean uses container managed transaction demarcation, message acknowledgment is handled automatically as a part of the transaction commit. If bean managed transaction demarcation is used, the message receipt cannot be part of the bean-managed transaction, and, in this case, the receipt is acknowledged by the container. If bean managed transaction demarcation is used, the Bean Provider can indicate in the acknowedge-mode deployment descriptor element whether JMS AUTO_ACKNOWLEDGE semantics or DUPS_OK_ACKNOWLEDGE semantics should apply. If the acknowledge-mode deployment descriptor element is not specified, JMS AUTO_ACKNOWLEDGE semantics are assumed.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
SCJP 1.4, SCWCD 1.4, SCBCD 1.5, TOGAF 9, Comptia Cloud+
Don't get me started about those stupid light bulbs. |