SCBCD Guide | ||
Home | SCJP | SCWCD | SCBCD | SCEA | SCSA |
--------------------------------------------------
MESSAGE BEAN
--------------------------------------------------
1. The following are the requirements for the message-driven bean class:
The class must implement, directly or indirectly, the
javax.ejb.MessageDrivenBean interface.
The class must implement, directly or indirectly, the javax.jms.MessageListener
interface.
The class must be defined as public, must not be final, and must not be
abstract.
The class must have a public constructor that takes no arguments.
The Container uses this constructor to create instances of the message-driven
bean class.
Each message-driven bean class must have one ejbCreate method, with no
arguments.
The class must not define the finalize() method.
2. The order is not guaranteed for javax.jms.Topic (but it is for
javax.jms.Queue)
3. Container may create multiple instances of the bean but one message will be
given to only one bean instance
whether it is bound to a queue or topic.
4. Only one thread will execute a MDB instance at a time.
5. A message-driven bean does not have to be coded as reentrant.
A container allows many instances of a message-driven bean class to be executing
concurrently.
6. By default, there is NO tx attribute for onMessage()
7. If a durable topic subscription is used (also Queues), then even if the EJB
Server is NOT running, the messages
will NOT be missed.
Non-durable Topics can be missed
8. A container may create multiple instances of the bean but one message will be
given to only one bean instance
whether it is bound to a queue or topic.