简体   繁体   English

JBoss 5.1.0 + EJB 3.1 + JMS

[英]JBoss 5.1.0 + EJB 3.1 + JMS

Can somebody advice me what I need to do in jboss to deploy message driven bean. 有人可以建议我在jboss中部署消息驱动bean需要做什么。 In particular I am looking answers on following questions: 我特别在寻找以下问题的答案:

  1. Do I need to define jms topic, connection factory etc... in config files, if yes where and how 我是否需要在配置文件中定义jms主题,连接工厂等...
  2. Where I will specify a url to remote JMS server 我将在哪里指定远程JMS服务器的URL

Any helpful links or code snippets really appreciated 非常感谢任何有用的链接或代码段

UPDATE#1: Maybe I explained myself not very well, my clarification is about architecture. UPDATE#1:也许我对自己的解释不是很好,我的澄清是关于体系结构的。 I have external JMS server which is deployed on separate machine and I want to create EJB3 MDR Bean to receive messages from particular topc. 我有部署在单独计算机上的外部JMS服务器,并且我想创建EJB3 MDR Bean来接收来自特定topc的消息。 I know all properties like host, port, username and password, and I am able to send and receive messages via JMS api. 我知道所有属性,例如主机,端口,用户名和密码,并且能够通过JMS api发送和接收消息。 What I want to do is to create and configure properly MDR Bean on top of jboss, but I am not sure where to put all these configuration like host, port, username, password etc... 我想要做的是在jboss上正确创建和配置MDR Bean,但是我不确定将所有这些配置(例如主机,端口,用户名,密码等)放在哪里。

Your Message Driven Bean itself will be deployed into the container using a standard EJB Spec compliant deployment descriptor or annotations on the MDB itself. 您的消息驱动Bean本身将使用与EJB Spec兼容的标准部署描述符或MDB自身上的注释部署到容器中。

Here is an example from the JBoss Community Wiki. 这是来自JBoss社区Wiki的示例 Its a little complex as it has a bunch of extra things in it including transaction support, injection of session beans, etc. But it demonstrates how to create an EJB3 MDB from annotations. 它有点复杂,因为它有很多其他功能,包括事务支持,会话Bean的注入等。但是它演示了如何从注释创建EJB3 MDB。 It may be worth playing with just to see what you can omit. 只看您可以忽略什么可能是值得的。 You may also need to play with it a bit just to get it to work(for instance you may not have a bean for IMySessionBean - so perhaps you will just get rid of this entirely and replace with a println() or something to get yourself started) 您可能还需要稍微尝试一下才能使其正常工作(例如,您可能没有IMySessionBean的Bean-因此,也许您会完全摆脱它,而用println()代替,或者使用某种方法使自己工作)开始)

As for your message producer If its standalone java app the url's etc. will be supplied through the properties supplied to your JNDI InitialContext when creating your ConnectionFactory. 至于您的消息生产者,如果它是独立的Java应用程序,则在创建ConnectionFactory时将通过提供给JNDI InitialContext的属性来提供url等。 This is demonstrated in this example 在此示例中对此进行了演示

If you are in the container, refer to the first example above which also provides an example using the JMSXA connection factory(a special connection factory specific to the container that has addtional features related to JCA- connection pooling, etc.). 如果您在容器中,请参考上面的第一个示例,该示例还提供了使用JMSXA连接工厂的示例(JMSXA连接工厂),该容器是特定于容器的特殊连接工厂,具有与JCA连接池等相关的附加功能。

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

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