1 2 3 Previous Next 32 Replies Latest reply on Jul 16, 2013 3:34 AM by hoedic

    MDB to durable topic not receiving messages with HornetQ 2.1.2 & Jboss 4.2.3

    jmihalich1

        Hi,

       

          I have successfully configured hornetq 2.1.2 Final inside jboss 4.2.3, and I have a topic setup.  Jboss 4.2.3 starts up without exceptions, and the topic is deployed in the jmx-console, and I see it in JNDI, along with the connection factories.

       

          I am then able to connect to the topic as a consumer via an external java client, and publish a message to the topic via another client, and the consumer receives the message.  So all signs point to hornetq being configured properly.

       

         However, my ear (ejb 2.1) has an MDB which has a durable subscription to this topic, but it is not receiving any messages.  When I look at the topic in the jmx-console, it shows no durable subscribers.

       

         There are no exceptions on startup.  If i change the name of the topic in the hornetq-jms.xml file, or remove the user/role from the user/role fles, jboss throws exceptions when trying to deploy the MDB on startup.  So that shows that JBoss is trying to bind to the topic.

       

         My MDB is not receiving any of the messages I publish, and I can't at this point, figure out why.  Here is my MDB declaration, along with some of the config files for hornetq:

       

      MDB Declaration:

       

      /**
      * @ejb:bean name="ejb/ConfigurationManagerMdb" transaction-type="Container"
      *           destination-type="javax.jms.Topic" subscription-durability="Durable" acknowledge-mode="Auto-acknowledge"
      * @ejb:transaction type="Required"
      * @jboss:destination-jndi-name name="topic/ConfigurationManager"
      * @jboss:subscriber name="vuecfguser1" password="vuecfguser1" subscription-id="DurableConfigurationManagerSubscription"
      * @jboss:invoker-proxy-binding name="ConfigurationManagerMdb-mdb-invoker"
      * @ejb.resource-ref res-name="topic/XAConnectionFactory" res-type="javax.jms.TopicConnectionFactory"
      *               res-auth="Container" jndi-name="topic/XAConnectionFactory"
      * @ejb.resource-env-ref name="topic/ConfigurationManager" type="javax.jms.Topic"
      *                       jndi-name="topic/ConfigurationManager"
      */

       

      public class ConfigManagerMdb implements javax.ejb.MessageDrivenBean, javax.jms.MessageListener

      ...

       

       

      hornetq-jms.xml file

       

      <configuration xmlns="urn:hornetq"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

       

         <connection-factory name="NettyConnectionFactory">
            <connectors>
               <connector-ref connector-name="netty"/>
            </connectors>
            <entries>
               <entry name="/ConnectionFactory"/>
               <entry name="/XAConnectionFactory"/>
               <entry name="/queue/XAConnectionFactory"/>
               <entry name="/queue/ClientXAConnectionFactory"/>
               <entry name="/topic/XAConnectionFactory"/>
               <entry name="/topic/ClientXAConnectionFactory"/>
            </entries>
         </connection-factory>
        
         <connection-factory name="NettyThroughputConnectionFactory">
             <connectors>
               <connector-ref connector-name="netty-throughput"/>
             </connectors>
              <entries>
                  <entry name="/ThroughputConnectionFactory"/>
                  <entry name="/XAThroughputConnectionFactory"/>
              </entries>
          </connection-factory>
        
         <connection-factory name="InVMConnectionFactory">
            <connectors>
               <connector-ref connector-name="in-vm"/>
            </connectors>
            <entries>
               <entry name="java:/ConnectionFactory"/>
               <entry name="java:/XAConnectionFactory"/>
               <entry name="java:/queue/XAConnectionFactory"/>
               <entry name="java:/queue/ClientXAConnectionFactory"/>
               <entry name="java:/topic/XAConnectionFactory"/>
               <entry name="java:/topic/ClientXAConnectionFactory"/>
            </entries>
         </connection-factory>
        
         <queue name="DLQ">
            <entry name="/queue/DLQ"/>
         </queue>
        
         <queue name="ExpiryQueue">
            <entry name="/queue/ExpiryQueue"/>
         </queue>

       

         <topic name="ConfigurationManager">
            <entry name="/topic/ConfigurationManager"/>
         </topic>
        
      </configuration>

       

       

      jms-ds.xml file

       

      <connection-factories>
         <!--
          JMS Stuff
         -->

       

         <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=JMSProvider">
            <attribute name="ProviderName">DefaultJMSProvider</attribute>
            <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
            <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
            <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
            <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
         </mbean>
        
        <!-- The server session pool for Message Driven Beans -->
        <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader"
           name="jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool">
          <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
          <attribute name="PoolName">StdJMSPool</attribute>
          <attribute name="PoolFactoryClass">
            org.jboss.jms.asf.StdServerSessionPoolFactory
          </attribute>
        </mbean>
       
        <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=ConfigManagerTopicHostJMSProvider">
          <attribute name="ProviderName">ConfigManagerTopicHostJMSProvider</attribute>
          <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
          <attribute name="QueueFactoryRef">java:/queue/XAConnectionFactory</attribute>
          <attribute name="TopicFactoryRef">java:/topic/XAConnectionFactory</attribute>
        </mbean>
        
        
         <!--
          JMS XA Resource adapter, use this to get transacted JMS in beans
         -->
         <tx-connection-factory>
            <jndi-name>JmsXA</jndi-name>
            <xa-transaction/>
            <rar-name>jms-ra.rar</rar-name>
            <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
            <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
            <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
            <max-pool-size>20</max-pool-size>
            <security-domain-and-application>JmsXARealm</security-domain-and-application>
         </tx-connection-factory>
      </connection-factories>

       

       

      Jboss.xml file

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">

       

      <jboss>

       

         <unauthenticated-principal>nobody</unauthenticated-principal>

       

         <enterprise-beans>

       

           <!--
             To add beans that you have deployment descriptor info for, add
             a file to your XDoclet merge directory called jboss-beans.xml that contains
             the <session></session>, <entity></entity> and <message-driven></message-driven>
             markup for those beans.
           -->

       

            <session>
               <ejb-name>ejb/ConfigManager</ejb-name>
               <jndi-name>ejb/ConfigManager</jndi-name>
               <local-jndi-name>ejb/ConfigManagerLocal</local-jndi-name>

       

              <method-attributes>
              </method-attributes>

       

          <!-- Start: BD:Added based on the patch for XDT-1138 -->
          <!-- End: BD:Added based on the patch for XDT-1138 -->

       

            </session>

       

            <message-driven>
               <ejb-name>ejb/ConfigurationManagerMdb</ejb-name>                      
               <destination-jndi-name>topic/ConfigurationManager</destination-jndi-name>
               <mdb-user>vuecfguser1</mdb-user>
               <mdb-passwd>vuecfguser1</mdb-passwd>
               <mdb-subscription-id>DurableConfigurationManagerSubscription</mdb-subscription-id>
               <invoker-bindings>
                 <invoker>
                   <invoker-proxy-binding-name>ConfigurationManagerMdb-mdb-invoker</invoker-proxy-binding-name>
                 </invoker>
               </invoker-bindings>

       

               <resource-ref>
                  <res-ref-name>topic/XAConnectionFactory</res-ref-name>
                  <jndi-name>topic/XAConnectionFactory</jndi-name>
               </resource-ref>
               <resource-env-ref>
                  <resource-env-ref-name>topic/ConfigurationManager</resource-env-ref-name>
                  <jndi-name>topic/ConfigurationManager</jndi-name>
               </resource-env-ref>
            </message-driven>
          <!--
            write a merge file jboss-webservices.ent for webservice-description
          -->

       

         </enterprise-beans>

       

         <resource-managers>
         </resource-managers>

       

             <!--
              *************This file is to be merged into jboss.xml, which is generated by ejbdoclet task *************
             These are container settings, and it can contain <invoker-proxy-bindings/> and <container-configurations/>.

       

             This file must reside on the XDoclet merge directory (defined in "jboss" subtask within the "ejbdoclet" task, which
              is defined in build.xml) and must be named "jboss-container.xml".
           -->
         <invoker-proxy-bindings>
            <invoker-proxy-binding>
               <name>ConfigurationManagerMdb-mdb-invoker</name>
               <invoker-mbean>does-not-matter</invoker-mbean>
               <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
               <proxy-factory-config>
                  <JMSProviderAdapterJNDI>ConfigManagerTopicHostJMSProvider</JMSProviderAdapterJNDI>
                  <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
                  <MinimumSize>1</MinimumSize>
                  <MaximumSize>1</MaximumSize>
                  <KeepAliveMillis>30000</KeepAliveMillis>
                  <MaxMessages>1</MaxMessages>
                  <MDBConfig>
                     <ReconnectIntervalSec>10</ReconnectIntervalSec>
                     <DLQConfig>
                        <DestinationQueue>queue/DLQ</DestinationQueue>
                        <MaxTimesRedelivered>1000000</MaxTimesRedelivered>
                        <TimeToLive>0</TimeToLive>
                     </DLQConfig>
                  </MDBConfig>
               </proxy-factory-config>
            </invoker-proxy-binding>
         </invoker-proxy-bindings>

       

      </jboss>

       

        I thought perhaps HornetQ-491 in JIRA could also apply to jboss 4.2.3, so I tried out the solution to hot-deploy the ear again while jboss is running, and it did not fix the problem.

       

        Am I doing something wrong here?  We were using jboss messaging and everything was working fine.  I have a fresh jboss-4.2.3 with hornetq now that I'm experimenting with, and I can't get by this last step.

       

        I attached a zip file with TRACE logging turned on for hornetq, and jboss of jboss starting up.  The name of the MDB is called ConfigurationManagerMdb.

       

       

      Thanks,

      Joe

        1 2 3 Previous Next