1 Reply Latest reply on May 2, 2006 10:50 PM by java_steve

    Cannot subscribe an MDB to a topic or queue

    java_steve

      Hello everyone.

      I have been searching for this solution for days and I cannot seem to find the right answer. I have tried to confugure my MDB to listen on a topic or queue that I have setup in jboss and it just seems to iqnore the configuration in the jboss.xml file, here is the jboss.xml


      <message-driven>
      <ejb-name>MessageBean</ejb-name>
      <destination-jndi-name>topic/ForumTopic</destination-jndi-name>
      <mdb-user>john</mdb-user>
      <mdb-passwd>needle</mdb-passwd>
      </message-driven>


      ejb-jar.xml


      <message-driven >
      <![CDATA[Description for MessageBean]]>
      <display-name>MessageBean</display-name>

      <ejb-name>MessageBean</ejb-name>

      <ejb-class>org.concordia.forum.messaging.MessageBean</ejb-class>

      <transaction-type>Container</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Topic</destination-type>
      </message-driven-destination>

      </message-driven>

      I have setup the topic like this in the in a seperate file "formmq-service.xml" I put into the
      C:\jboss-4.0.3SP1\server\default\deploy\jms directory


      <mbean code=org.jboss.mq.server.jmx.Topic name=jboss.mq.destination:service=Topic,name=ForumTopic>
      <depends optional-attribute name=DestinationManager>jboss.mq:service=DestinationManager
      <depends optional-attribute-name=SecurityManager>jboss.mq:service=SecurityManager
      <attribute name=SecurityConf>

      <role name=guest read=true write=true/>
      <role name=publisher read=true write=true create=true/>
      <role name=durpublisher read=true write=true create=true/>




      There is an ending "depends" at the end of the lines above, it is not showing in this WSYWIG


      If I use the MDB name "MessageBean" when I publish the message everything works because jboss creates a topic with the name of the bean, which is ok but the reason I need a topic is because I need multiple subscriptions.
      I was also having a problem deploying the EJB with a durable subscription, every time I try deploy with the below config line in the message-driven-destination tag

      <subscription-durability>Durable</subscription-durability>

      I get an error at startup "cannot subscribe to null topic"

        • 1. Re: Cannot subscribe an MDB to a topic or queue
          java_steve

          Well I found the solution to the problem, I did had a typo in the packaging config and every time I deployed the app the jboss.xml did not go with it and that was where we were declaring the destination. Once I fixed this the whole thing worked including the durable subscriber

          I hope this helps someone out!!

          Thanks @;)