Meaningless Drivel is fun!*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Message listener interface of a Message-Driven Bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Message listener interface of a Message-Driven Bean?" Watch "Message listener interface of a Message-Driven Bean?" New topic
Author

Message listener interface of a Message-Driven Bean?

Treimin Clark
Ranch Hand

Joined: Nov 12, 2008
Posts: 757
Question is from WhizLabs Diagnostic Exam - Question 21

Which of the following are valid statements regarding the message listener interface required by the message driven bean?

[A] Bean's message listener interface cannot define more than one message listener method.
[B] For multiple methods in message listener interface, it is resource adaptor, which determines which method to call.
[C] Message listener interface has no role to play in determining the supported messaging type by a message driven bean.
[D] Message listener interface actually distinguishes the messaging type a message bean can support


According to WhizLabs, B and D are the correct answers.

I couldn't understand anything about this. Can someone tell me what is this message listener interface, and will it appear on the real exam?
Ralph Jaus
Ranch Hand

Joined: Apr 27, 2008
Posts: 342
Yes, you should expect questions about MDB's on the exam (a MDB needs a message listener interface).

I recommend reading chapter 5 in core spec. For instance, parts of Whizzlab's question can be answered directly from 5.4.2.


SCJP 5 (98%) - SCBCD 5 (98%)
Treimin Clark
Ranch Hand

Joined: Nov 12, 2008
Posts: 757
Ralph, I know about MDB. But I don't know anything about the message driven listener interface, as it is used in this question.
Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
@MessageDriver annotation has an element whose name is messageListenerInterface. You can specify it this way, or by simply implementing the interface. Most of the time for the exam it is javax.jms,MessageListener with its onMessage() method.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Raf -- Is there any annotation named MessageDriver?? I guess you probably had meant MessageDriven!


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
Yup, @MessageDriven. I always make this typo, not sure why!
Jun Liu
Greenhorn

Joined: Nov 15, 2005
Posts: 11
This question actually has two pairs, A or B, C or D. For the first pair, I am not sure. For the second pair, take the example of JMS MessageListner, the onMessage(Message msg) need the JMS message type. So it actually distinguish the message type, which is a javax.jms.Message.

The thing that is confusing here is almost all the examples for MDB is using JMS MessageListener, so our thinking is confined on it. And JMS has its own message types, ObjectMessage, TextMessage and so on. MDB can not distinguish these types. But the "message type" here means a bigger scope. That is, other than JMS, MDB can support other message system.

So for the first pair, the JMS MessageListener only has one method onMessage(). That doesn't mean other message system can only have one method.

Is my understanding right?
 
jQuery in Action, 2nd edition
 
subject: Message listener interface of a Message-Driven Bean?
 
Similar Threads
MDB and its strange inheritance
Mock Question about Transactions
how to understand this regarding multiple message listener method?
Whizlabs Exam Simulator
Question using EJB 2.1 MDB's.