[jboss-user] [EJB 3.0] - Re: Injection of QueueConnectionFactory and Queue from ENC i

jaikiran do-not-reply at jboss.com
Mon Mar 2 01:47:15 EST 2009


Finally got some time to figure this out.

The application-client.xml and the jboss-client.xml provide specific elements for referencing message destinations (queue/topic). So instead of using a resource-ref for a queue, use the message-destination-ref as follows:

<?xml version="1.0" encoding="UTF-8"?>
  | 
  | <application-client id="Application-client_ID" version="5"
  | 	xmlns="http://java.sun.com/xml/ns/javaee"
  | 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  | 	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application-client_5.xsd">
  | 	<display-name>
  | 	MessageClient</display-name>
  | 
  | 
  | 	<resource-ref>
  |       <res-ref-name>jms/MBConnectionFactory</res-ref-name>
  |       <res-type>javax.jms.QueueConnectionFactory</res-type>
  |       <res-auth>Container</res-auth>
  |    </resource-ref>
  | 
  | <message-destination-ref>
  |       <message-destination-ref-name>jms/MBQueueRef</message-destination-ref-name>
  |       <message-destination-type>javax.jms.Queue</message-destination-type>
  | 
  | </message-destination-ref>
  | 
  | 
  | </application-client>
  | 
  | 

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss-client PUBLIC
  |   "-//JBoss//DTD Application Client 5.0//EN"
  |   "http://www.jboss.org/j2ee/dtd/jboss-client_5_0.dtd">
  | <jboss-client>
  | 
  |   <jndi-name>MessageClient</jndi-name>
  | 
  |   <resource-ref>
  |       <res-ref-name>jms/MBConnectionFactory</res-ref-name>
  |       <jndi-name>ConnectionFactory</jndi-name>
  |   </resource-ref>
  | 
  | <message-destination-ref>
  |       <message-destination-ref-name>jms/MBQueueRef</message-destination-ref-name>
  |       <jndi-name>queue/MessageBeanQueue</jndi-name>
  | </message-destination-ref>
  | 
  | 
  | </jboss-client>
  | 

Then you can use @Resource in the application client to inject this:

  @Resource(name="jms/MBConnectionFactory")
  |   private static QueueConnectionFactory queueConnectionFactory;
  | 
  |   @Resource(name="jms/MBQueueRef")
  |   private static Queue queue;
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4214070#4214070

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4214070



More information about the jboss-user mailing list