2 Replies Latest reply on Mar 29, 2010 4:13 AM by Tim Fox

    JNDI on JBoss with Hornetq ( yes again :-)   )

    BJ Chippindale Master

      OK....

       

      With a live - backup pair on different servers in different counties.

       

      Configuring node 1 as live and node 2 as backup.

       

      hornetq-configuration.xml appears straightforward from the manual.

       

      What goes into the hornetq-jms.xml for the live and backup.

       

      I THINK it looks like -  the manual points back to chapter 38 but the example seems to indicate this.

       

      Node1

      <connection-factory name="ConnectionFactory">
         <connectors>
            <connector-ref connector-name="my-connector1"
                 backup-connector-name="my-backup-connector1"/>\
         </connectors>
         <entries>
            <entry name="ConnectionFactory"/>
         </entries>
      </connection-factory>

       

      Node2

      <connection-factory name="ConnectionFactory">
         <connectors>
            <connector-ref connector-name="my-backup-connector1"/>
         </connectors>
         <entries>
            <entry name="ConnectionFactory"/>
         </entries>
      </connection-factory>

       

      __________________________

       

      However, I am puzzled about how the JNDI will work.  As I am ALWAYS puzzled.  The backup server doesn't have a reference to the live one.  Since the JNDI is handled by JBoss but is not HAJNDI it isn't clear that it will obtain knowledge of the server on the live node.  

       

      Could someone please tell me whether I have to alter JNDI references that are intended to fetch JMS Connection Factories on node2 and must fetch them from node1?    It seems to ME that I should but I have a lot more wrong answers than right ones.   :-)

       

      Perhaps this be explained by example?

       

      Perhaps I should talk the team into HAJNDI ?

       

      respectfully

      BJ

        • 1. Re: JNDI on JBoss with Hornetq ( yes again :-)   )
          Maurice Zeijen Master

          This is more a JNDI question then HornetQ specific.

           

          I guess that you have clients that connect from outside of the JBoss AS VM to your HornetQ service.

           

          If I understand you correctly then you are wondering how a JNDI client can resolve the ConnectionFactory or a Queue/Topic Object on the backup system (I presume after the live system failed) if you don't have a reference to that backup system in your JNDI. The anwer is that with normal JNDI you can't resolve the backup server if you don't have it listed in your provider url. The solution with normal JNDI is to list the urls of both the live and backup systems in a comma separated list for the 'java.naming.provider.url' context variable. For example the JNDI provider url property could look like this:

           

          java.naming.provider.url=live.jboss.server:1099,backup.jboss.server:1099
          

           

          HAJNDI can help you only partially. When your server tries to resolve the ConnectionFactory from a HAJNDI then the HAJNDI provider still needs to be available. So when your live server only provides HAJNDI and it is down then you still won't be able to resolve the ConnectionFactory from the backup server. In that case you still need to list both servers. The nice thing about HAJNDI is that you can also use broadcasting to find the server. That way you don't have to list any servers but just there clustering information. Also if you have a cluster with more then two servers then HAJNDI can help you to locate a service anywhere on the cluster.

           

          If your HornetQ runs standalone then HAJNDI can't help you. The HornetQ server doesn't provide HAJNDI :(.

           

          More info on client (HA)JNDI settings with JBoss can be found here: http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/5.0.0/html/Administration_And_Configuration_Guide/ch16s02s02.html The JBoss Enterprise Application Platform documentation is very helpfull in these cases.

          • 2. Re: JNDI on JBoss with Hornetq ( yes again :-)   )
            Tim Fox Master

            HA-JNDI is just a JBoss AS service.

             

            If you want it in HornetQ standalone, just define the bean in the beans.xml file and copy the correct jars across. You could do this with any JBoss AS service.

             

            Bear in mind that JBoss AS is just an instance of JBoss microcontainer with a load of services running in it. HornetQ standalone is also an instance of JBoss microcontainer but with less services running it (by default only JNDI and Hornet Serve).

             

            Take a look at the JBoss MC docs for more info.

            1 of 1 people found this helpful