JBoss 5.1.0 + EJB 3.1 + JMS
Can somebody advice me what I need to do in jboss to deploy message driven bean. In particular I am looking answers on following questions:
- Do I need to define jms topic, connec开发者_开发知识库tion factory etc... in config files, if yes where and how
- Where I will specify a url to remote JMS server
Any helpful links or code snippets really appreciated
UPDATE#1: Maybe I explained myself not very well, my clarification is about architecture. 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. I know all properties like host, port, username and password, and I am able to send and receive messages via 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...
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.
Here is an example from the JBoss Community 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. 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)
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. 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.).
精彩评论