1 Reply Latest reply on Sep 16, 2005 4:13 PM by Steven Schmidt

    jbossmq-state.xml contains ClientIDs for same MDB

    Paul Carroll Newbie

      I am running JBoss 3.2.0. I have configured JMS so that the messages are written to SQL Server as opposed to the default Hypersonic database. This all works correctly. When I start the application, I notice the jbossmq-state.xml has the deployed MDB's written in it in the following example:

      <DurableSubscription>
       <ClientID>ID:3 </ClientID>
       <Name>MyMDB1</Name>
       <TopicName>MyTopic</TopicName>
      </DurableSubscription>
      <DurableSubscription>
       <ClientID>ID:9</ClientID>
       <Name>MyMDB2</Name>
       <TopicName>MyTopic</TopicName>
      </DurableSubscription>


      When the application posts a topic, the record is written to the JMS_MESSAGES table in the SQL Server database and then consumed.

      However, when I restart the application, the jbossmq-state.xml will look like the following on occassion:

      <DurableSubscription>
       <ClientID>ID:3</ClientID>
       <Name>MyMDB1</Name>
       <TopicName>MyTopic</TopicName>
      </DurableSubscription>
      <DurableSubscription>
       <ClientID>ID:9</ClientID>
       <Name>MyMDB2</Name>
       <TopicName>MyTopic</TopicName>
      </DurableSubscription>
      <DurableSubscription>
       <ClientID>ID:11</ClientID>
       <Name>MyMDB1</Name>
       <TopicName>MyTopic</TopicName>
      </DurableSubscription>
      <DurableSubscription>
       <ClientID>ID:17</ClientID>
       <Name>MyMDB2</Name>
       <TopicName>MyTopic</TopicName>
      </DurableSubscription>


      When a message is produced and written to the database, the messages with ClientID 3 and 9 will not be consumed. These rows will live in the database until someone manually goes in there to delete them. Does anyone know the cause and possible solution as to why this may be occurring? Thanks.

        • 1. Re: jbossmq-state.xml contains ClientIDs for same MDB
          Steven Schmidt Newbie

          I found navigating this site for an answer to this problem very frustrating and confusing, as much was contrdictory and it was often difficult to see which version of JBoss it applied to, but the answer I found was that you can specify the mdb-user and mdb-passwd tags in the jboss.xml file and to assign the value from the mdb-subscription-id tag to the users in jbossmq-state.xml. This way, the mdbs get deployed with a specific ID rather than a system assigned ID that might change on a restart.
          from jboss.xml...

          
          <message-driven>
           <ejb-name>myMDB1</ejb-name>
           <destination-jndi-name>topic/MDBTopic</destination-jndi-name>
           <mdb-user>jane</mdb-user>
           <mdb-passwd>thread</mdb-passwd>
           <mdb-subscription-id>myMDB1</mdb-subscription-id>
           <configuration-name>Standard Message Driven Bean</configuration-name>
           <resource-ref>
           <res-ref-name>jms/TopicConnectionFactory</res-ref-name>
           <jndi-name>ConnectionFactory</jndi-name>
           </resource-ref>
           <resource-env-ref>
           <resource-env-ref-name>jms/MDBTopic</resource-env-ref-name>
           <jndi-name>topic/MDBTopic</jndi-name>
           </resource-env-ref>
           </message-driven>
          

          from jbossmq-state.xml

           <User>
           <Name>jane</Name>
           <Password>thread</Password>
           <Id>myMDB1</Id>
           </User>
           </Users>
           <Roles>
           <Role name="guest">
           <UserName>guest</UserName>
           <UserName>john</UserName>
           </Role>
           <Role name="subscriber">
           <UserName>john</UserName>
           <UserName>jane</UserName>
           </Role>
           <Role name="publisher">
           <UserName>john</UserName>
           <UserName>dynsub</UserName>
           </Role>
           <Role name="durpublisher">
           <UserName>john</UserName>
           <UserName>dynsub</UserName>
           <UserName>jane</UserName>
           </Role>
          


          The durable subscriptions get added to the file on deployment as:
           <DurableSubscriptions>
           <DurableSubscription>
           <ClientID>myMDB1</ClientID>
           <Name>myMDB1</Name>
           <TopicName>MDBTopic</TopicName>
           </DurableSubscription>
           <DurableSubscription>
           <ClientID>myMDB2</ClientID>
           <Name>myMDB2</Name>
           <TopicName>MDBTopic</TopicName>
           </DurableSubscription>
           </DurableSubscriptions>
          

          myMDB2 was another one assigned to john.