[jboss-user] [EJB 3.0] - Clustered MDB configuration

ejb3workshop do-not-reply at jboss.com
Tue Oct 9 09:49:42 EDT 2007


I have 3 MDBs configures in a chain

BatchJobProcessor > TransactionProcessor > OutputProcessor

which I have deployed into a cluster. My aim is to maintain as much portability as possible in my code and defer the JNI configuration to the deployment descriptors:

I tried configuring the Qs using a services file but it seems to only deploy the Qs on the first node and fail on all other nodes. The error reported on the other nodes was that the DestinationManager was missing, but was a requirement for the Q. If there is a better way to do this please let me know.


  | <?xml version="1.0" encoding="UTF-8"?>
  | <server>
  |   <mbean code="org.jboss.mq.server.jmx.Queue"
  | 	 name="jboss.mq.destination:service=Queue,name=BatchJobProcessorMDB">
  |          <attribute name="JNDIName">queue/BatchJobProcessors</attribute> 
  |     <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
  |   </mbean>
  |   <mbean code="org.jboss.mq.server.jmx.Queue"
  | 	 name="jboss.mq.destination:service=Queue,name=TransactionProcessorsMDB">
  |          <attribute name="JNDIName">queue/TransactionProcessors</attribute> 
  |     <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
  |   </mbean>
  |   <mbean code="org.jboss.mq.server.jmx.Queue"
  | 	 name="jboss.mq.destination:service=Queue,name=OutputProcessorsMDB">
  |          <attribute name="JNDIName">queue/OutputProcessors</attribute> 
  |     <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
  |   </mbean>
  | </server>
  | 

So I gave up on the option of using a services file and rely on the container to create teh queues for me.


In BatchJobProcessor :

  |     @Resource(name="jms/ConnectionFactory")
  |     private QueueConnectionFactory factory;
  | 
  |     @Resource(name="queue/TransactionProcessors")
  |     private Queue queue;
  | 

In TransactionProcessor :

  |     @Resource(name="jms/ConnectionFactory")
  |     private QueueConnectionFactory factory;
  |     
  |     @Resource(name="queue/OutputProcessors")
  |     private Queue queue;
  | 

Then I added the following to my ejb-jar.xml

  |       <message-driven>
  |             <ejb-name>BatchJobProcessor</ejb-name>
  |             <ejb-class>com.thunderhead.backend.BatchJobProcessor</ejb-class>
  |             <transaction-type>Bean</transaction-type>
  |             <resource-ref>
  |                 <description/>              
  |                 <res-ref-name>jms/ConnectionFactory</res-ref-name>
  |                 <res-type>javax.jms.QueueConnectionFactory</res-type>
  |                 <res-auth>Container</res-auth>
  |                 <mapped-name>jnp://localhost:1100/ConnectionFactory</mapped-name>
  |             </resource-ref>
  |             <resource-ref>
  |                 <description/>                
  |                 <res-ref-name>queue/TransactionProcessors</res-ref-name>
  |                 <res-type>javax.jms.Queue</res-type>
  |                 <res-auth>Container</res-auth>
  |                 <mapped-name>jnp://localhost:1100/queue/TransactionProcessors</mapped-name>
  |             </resource-ref>
  |         </message-driven>
  | 

I was hoping to do the final mapping to the real JNDI name in the jboss.xml file, however during deployment an error require me to add the mapped Name element.

It seems to me that message servers (factories and queue) only exist in the HAJNDI context and need to be looked up via jnp://localhost:1100/... My attempt to look up those services in the local JNDI context failed so far.


I do have the jboss.xml file configured, but it does not seem to have any effect. I wonder what I missed as I would prefer to keep the jboss specific binding to the real jndi name in a jboss specific configuration file.

  |       <message-driven>
  |          <ejb-name>BatchJobProcessor</ejb-name>        
  |          <destination-jndi-name>queue/BatchJobProcessors</destination-jndi-name>
  |          <resource-ref>
  |              <res-ref-name>jms/ConnectionFactory</res-ref-name> 
  |              <jndi-name>jnp://localhost:1100/ConnectionFactory</jndi-name>             
  |          </resource-ref>
  |          <resource-ref>
  |              <res-ref-name>queue/TransactionProcessors</res-ref-name> 
  |              <jndi-name>jnp://localhost:1100/queue/TransactionProcessors</jndi-name>             
  |          </resource-ref>
  |       </message-driven>
  | 

Thanks in advance
Alex

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

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



More information about the jboss-user mailing list