Hi,
I have a couple of MDBs that implement MessageListener like that and work
fine :
@MessageDriven(mappedName = "jms/topic/order")
public class OrderPrinterBean implements MessageListener {
}
I was reading a blog
<
http://radio.weblogs.com/0135826/2005/07/22.html>about MDBs and I
stoped on the following sentence "If you look carefully the
MDB does not implement the javax.jms.MessageListener interface because I'm
using the MDB to listen to a JMS provider". I wanted to have a try so I got
rid of the MessageListener interface and my MDBs still worked. I looked at
the spec but it's not really clear :
"*5.4.2 The Required Message Listener Interface
*The message-driven bean class must implement the appropriate message
listener interface for the messaging type that the message-driven bean
supports or specify the message listener interface using the MessageDriven
metadata annotation (...).
The message-driven bean class's implementation of the
javax.jms.MessageListener
interface distinguishes the message-driven bean as a JMS message-driven
bean.
The bean's message listener method (e.g., onMessage in the case of
javax.jms.MessageListener)
is called by the container when a message has arrived for the bean to
service. (...)
If the message-driven bean class implements more than one interface other
than java.io.Serializable,
java.io.Externalizable, or any of the interfaces defined by the
javax.ejbpackage,
the message listener interface must be specified by the
messageListenerInterface element
of the MessageDriven annotation or the messaging-type element of the
message-driven
deployment descriptor element."
Could anybody explain why GlassFish still invokes my MDBs even if they don't
implement any interface ?
Thanks,
Antonio
PS : Happy new year