6 Replies Latest reply on Sep 3, 2008 11:21 AM by justkeys

    How to run a Queue and MDB into a cluster

    dmary

      Hi all,

      I need to migrate a queue and mdb into a cluster configuration.

      I've read mutliple wiki and docs and I need some help.
      I'm running all into a Jboss AS 4.05 Ga.

      Actualy, to create queue, it is done directly by Jboss , in reading annotation from my MDB. I haven't any xml files, all is done automaticly

      For example, this is my annotation into my java file of mdb :

      @MessageDriven(messageListenerInterface = MessageListener.class, activationConfig = {
       @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
       @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/Cmd2MuQueue"),
       @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
      




      Now, from what I've read, I understand that I've got to declare a queue and mdb into xml file and to put it (with java class of MDB) into JBOSS_HOME/deploy-hasingleton/jms.

      I've made a conf file for queue, named myqueue-service.xml :
      <mbean code="org.jboss.mq.server.jmx.Queue"
       name="jboss.mq.destination:service=Queue,name=Cmd2MuQueue">
       <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
       <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
       <attribute name="SecurityConf">
       <security>
       <role name="guest" read="true" write="true" create="true"/>
       </security>
       </attribute>
       <attribute name="ReceiversImpl">
       org.jboss.mq.server.ReceiversImplArrayList
       </attribute>
       </mbean>
      


      And I've made a jar file contains :
      + com
       + society
       + CmdMessageDrivenBean.class
      + META-inf
       + ejb-jar.xml
       + jboss.xml
      


      ejb-jar.xml :
      <ejb-jar>
       <enterprise-beans>
       <message-driven>
       <description>Singleton MDB, MyMDB</description>
       <ejb-name>MyMDB</ejb-name>
       <ejb-class>com.society.CmdMessageDrivenBean</ejb-class>
       <transaction-type>Container</transaction-type>
       <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
       <message-driven-destination>
       <destination-type>javax.jms.Queue</destination-type>
       </message-driven-destination>
       </message-driven>
       </enterprise-beans>
      
       <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>MyMDB</ejb-name>
       <method-name>onMessage</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>
       </assembly-descriptor>
      
      </ejb-jar>


      and jboss.xml :
      <jboss>
       <enterprise-beans>
       <message-driven>
       <ejb-name>MyMDB</ejb-name>
       <configuration-name>Singleton Message Driven Bean</configuration-name>
       <destination-jndi-name>queue/Cmd2MuQueue</destination-jndi-name>
       </message-driven>
       </enterprise-beans>
      </jboss>


      First question : is it the right way ?
      Second question : how I handle the fact that my mdb need to access to EJB3 classes , and these classes aren't loaded yet, so I've got an class loading error, as my EJB3 ared loaded after queue actualy.. ??

      Thanks a lot for ur responses.