MyMsg is a JMS message-driven bean with container-managed transaction demarcation.
FooBean is an EJB 3.x stateless session bean that sends message to the JMS destination with
MyMsgBean is associated.
MyMsgBeans message listener method has transaction attribute REQUIRED, and is defined as
follows:
10. public class MyMsgBean implements javax.jms.messageListener {
11. public void onMessage(javax.jms.Message message) {
12. / / do some work not shown here
13. thrown new RuntimeException(unexpected error . . . );
14. }
Which statement is true about the result of message processing?
A.
FooBean receives javax.ejb.EJBException.
B.
The container discards the MyMsgBean bean instance.
C.
FooBean receives the original RuntimeException thrown from the message listener method.
D.
The container does NOT roll back the transaction, and FooBean can continue the transaction.
Explanation:
Note: public interface MessageListener
A MessageListener object is used to receive asynchronously delivered messages.
Each session must insure that it passes messages serially to the listener. This means that a
listener assigned to one or more consumers of the same session can assume that the onMessage
method is not called with the next message until the session has completed the last call.Reference: Enum TransactionAttributeType
same as question 2, answer B
True, no beans start the message processing, MDB are client independent, so no Exceptions are propagated.
I thikn C it’s ok, but Why not B?
B