*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Mock question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Mock question" Watch "Mock question" New topic
Author

Mock question

Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
Hi all,

This is one of the questions from ejbcertificate.com.

The answers given are 1 and 5.

But i think only 1 is right, because the fifth is telling that send an acknowledgement to the message service when the transaction has failed. Is it so ? acknowledgment is only for failed transaction ?

Can any one help me to solve my doubt ??

The question

Which of the following statements are true about acknowledgement of messages within message-driven beans? [Check all correct answers]

1. A message arrived in onMessage() is placed back on the message queue if the transaction rolls back for container managed message beans.

2. A message arrived in onMessage() within a container managed message bean is placed back on the message queue when the onMessage() method returns false.

3. A message arrived in onMessage() within a container managed message bean is placed back on the message queue when the onMessage() throws a checked exception.

4. A container managed message bean can use the deployment descriptor to define how messages are acknowledged to the message service.


5. The <acknowledge-mode> attribute defines the way bean managed message bean's send an acknowledgement to the message service when the transaction has failed.

thank you ,
Sanju
Keerthi P
Ranch Hand

Joined: Aug 19, 2003
Posts: 203

5. The <acknowledge-mode> attribute defines the way bean managed message bean's send an acknowledgement to the message service when the transaction has failed.


It is not very clear what 'transaction failure' means in this context.

Did the transaction fail due to explicit ut.rollback() call?
- If yes, option 5 is valid. A BMT MDB acknowledges the JMS destination that it has successfully received the message.

Did the transaction fail due to a System Exception thrown from onMessage()?
- If yes, option 5 is not valid. The bean will not send any acknowledgement to the destination. The container destroys the bean instance and attempts to redeliver the message.


Cheers.<br />Keerthi<br />(SCJP, SCWCD, SCBCD)
Binoj Viswanathan
Ranch Hand

Joined: Feb 25, 2003
Posts: 85
hi,
i think in the case BMT MDB, txn has no impact on acknowledgement of msg since message reciept is not part of bean managed txn.The acknowledgement done by the contaner ven the onMessage Method returns successfully.If a s/m exce..n occurs message is placed back on the message queue.This can b controlled by the bean provider by specifying <acknowledge-mode> in th DD.

pls corect me if im wrong.......


Binoj V


SCJP 1.4(98%)<br />SCBCD1.3 (100%)<br />SCWCD 1.4 (93%)(w/o prep..n)
Binoj Viswanathan
Ranch Hand

Joined: Feb 25, 2003
Posts: 85
hi,
iv tried out abv scenarios. i found that with CMT MDB, if i call MDBContext.setRollbackOnly() container puts the msg again in the queue.With BMT MBD even if txn is rolledback by calling UsetTxnObj.rollback(),container is not placing the msg back in queue .even if s/m exce..n is thrown (in BMT MDB), the msg wont b placed back in queue.
i think my folowin statement is not valid

If a s/m exce..n occurs message is placed back on the message queue.


Binoj V
Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
Thank you....

Sanju.
 
wood burning stoves
 
subject: Mock question
 
Similar Threads
Mock question
Overall general doubts
Enthuware question doubt
Doubt on Enthuware mock regarding MDBs
AutoAcknowledge Mode in MDB