ejb3 in action 学习笔记之二_MDB

 
Messaging and developing MDBs
1 Message-oriented middleware is software that enables asynchronous messages between system components. 消息中间件是能在各系统组件间传递异步消息的软件。
2.
 ■ The MDB class must directly (by using the implements keyword in the class declaration) or indirectly (through annotations or descriptors) implement a message listener interface.
■ The MDB class must be concrete. It cannot be either a final or an abstract class.
■ The MDB must be a POJO class and not a subclass of another MDB.
■ The MDB class must be declared public.
■ The bean class must have a no-argument constructor. If you don’t have any constructors in your Java class, the compiler will create a default constructor.The container uses this constructor to create a bean instance.
■ You cannot define a finalize method in the bean class. If any cleanup code is necessary, it should be defined in a method designated as PreDestroy.
■ You must implement the methods defined in the message listener interface.These methods must be public and cannot be static or final.
■ You must not throw the javax.rmi.RemoteException or any runtime exceptions.If a RuntimeException is thrown, the MDB instance is terminated.
3 Two popular messaging models are standardized in Java EE: point-to-point (PTP) messaging and publish-subscribe messaging.
Point-to-point
You can probably guess from the names of the messaging models how they function. In the PTP scheme, a single message travels from a single producer (point A) to a single consumer (point B). PTP message destinations are called queues.
Publish-subscribe (pub-sub)
Publish-subscribe messaging is much like posting to an Internet newsgroup. A single producer produces a message that is received by any number of consumers who happen to be connected to the destination at the time. the message destination in this model is called a topic
and a consumer is called a subscriber.
 

你可能感兴趣的:(bean,中间件,Scheme)