简体   繁体   English

JMS使用者和消息驱动Bean(MDB)有什么区别

[英]What is the difference between JMS consumer and Message Driven Beans (MDB)

Is there any difference between an asynchronous JMS (Java Messaging Service) consumer vs an actual MDB (Message Driven Bean). 异步JMS(Java消息服务)使用者与实际MDB(消息驱动Bean)之间是否有任何区别。 The only difference I see is the MDB class has @MessageDriven annotation which the asynchronous JMS consumer doesn't. 我看到的唯一区别是MDB类具有@MessageDriven批注,异步JMS使用者没有。

Anything else that I am missing ? 我还有什么想念的吗?

Your MDB works as JMS consumer in your case. 在您的情况下,您的MDB充当JMS使用者。 MDB is EJB specific term and consumer is a JMS term. MDB是EJB特定术语,使用者是JMS术语。 A JMS consumer can be a message driven POJO as well which is not technically an EJB. JMS使用者也可以是消息驱动的POJO,从技术上讲它不是 EJB。

Answers to comments 评论的答案

A1. A1。 Yes it is correct to say that a plain JMS consumer cannot be pooled/managed like an EJB unless that JMS consumer happens to be managed by containers like EJB or Spring containers. 是的,可以说一个普通的JMS使用者不能像EJB一样被池化/管理,这是正确的,除非JMS使用者恰好是由EJB或Spring容器之类的容器来管理的。

A2. A2。 MDBs really just fulfills the requirement for asynchronous communication with EJBs. MDB确实满足了与EJB异步通信的要求。 When they are JMS based then your MDB is technically a JMS Consumer as well. 如果它们是基于JMS的,那么从技术上讲,您的MDB也是JMS使用者 But an MDB can be non-JMS based as well eg: JCA (Java Connector Architecture) based MDB. 但是MDB也可以基于JMS ,例如:基于JCA(Java连接器体系结构)的MDB。 You can see this post for more details about non-JMS based MDB: http://debupanda.blogspot.com/2006/08/using-ejb-30-message-driven-bean-with.html 您可以查看此帖子,以获取有关基于非JMS的MDB的更多详细信息: http : //debupanda.blogspot.com/2006/08/using-ejb-30-message-driven-bean-with.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM