7 Replies Latest reply on Jul 18, 2008 6:04 PM by clebert.suconic

    How the Java client connects to JNDI of JBM 2.0 alpha remote

    janylj

      Hello,

      I am checking out the JBM 2.0 alpha. Everything looks cool. I could run the example when the broker is localhost. However, how to connect the JNDI store using IP address instead of just localhost. For example, in the jndi.properties I have:

      java.naming.provider.url=jnp://ipaddress:1099


      Then I ran the same example program. I got

      queueExample:
       [java] javax.naming.CommunicationException: Could not obtain connection to any of these urls: 172.16.1.218:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server 172.16.1.218:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 172.16.1.218:1099 [Root exception is java.net.ConnectException: Connection refused]]]
       [java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1601)
       [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:636)
       [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
       [java] at javax.naming.InitialContext.lookup(InitialContext.java:392)
       [java] at org.jboss.jms.example.QueueExample.main(QueueExample.java:53)
       [java] Caused by: javax.naming.CommunicationException: Failed to connect to server 172.16.1.218:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 172.16.1.218:1099 [Root exception is java.net.ConnectException: Connection refused]]
       [java] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:276)
       [java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1572)
       [java] ... 4 more


      Please advise. Thank you.

        • 1. Re: How the Java client connects to JNDI of JBM 2.0 alpha re
          peterj

          Try starting the app server with the -b option http://wiki.jboss.org/wiki/JBoss42FAQ

          • 2. Re: How the Java client connects to JNDI of JBM 2.0 alpha re
            clebert.suconic

             

            "PeterJ" wrote:
            Try starting the app server with the -b option http://wiki.jboss.org/wiki/JBoss42FAQ


            This doesn't apply to janylj. JBoss Messaging 2 Alpha is standalone, and it runs outside of JBAS.

            "janylj" wrote:
            Hello,

            I am checking out the JBM 2.0 alpha. Everything looks cool. I could run the example when the broker is localhost. However, how to connect the JNDI store using IP address instead of just localhost. For example, in the jndi.properties I have:


            You should change jbm-configuration.xml, property remoting-host, and you should be fine.



            • 3. Re: How the Java client connects to JNDI of JBM 2.0 alpha re
              clebert.suconic

              And BTW... JBoss Messaging 2 @ SVN is already 30 or 40% faster on persistent messages than JBoss Messaging 2 Alpha :-)

              • 4. Re: How the Java client connects to JNDI of JBM 2.0 alpha re
                janylj

                Thank you, Clebert. It works.

                A follow up question is when I benchmark JBM 2.0.0.Alpha1, the throughputs for persistent delivery and non-persistent delivery are close. You know generally persistent delivery should be much slower than non-persistent one.

                Then I go back to your documentation. I am wondering whether persistent delivery is non-blocking by default. What's blocking and non-blocking? How to configure it?

                Test 5. Persist/Blocking/NonTX/AutoAck 1,265
                Test 6. Persist/Non Blocking/NonTX/AutoAck 12,056

                • 5. Re: How the Java client connects to JNDI of JBM 2.0 alpha re
                  clebert.suconic

                   

                  A follow up question is when I benchmark JBM 2.0.0.Alpha1, the throughputs for persistent delivery and non-persistent delivery are close. You know generally persistent delivery should be much slower than non-persistent one.


                  Yes... we are doing a lot of work on the journal, to make it run almost as fast as NonPersistent.


                  Then I go back to your documentation. I am wondering whether persistent delivery is non-blocking by default. What's blocking and non-blocking? How to configure it?


                  It is asynchronous by default. Look at jbm-jndi.xml. There is a ConnectionFactory called MyExampleConnectionFactory that would have some options you could change synchronous to asynchronous on NPersistent and Persistent Messages.

                  You can set anything around that in your connectionFactory.



                  • 6. Re: How the Java client connects to JNDI of JBM 2.0 alpha re
                    janylj

                    Which one makes much big difference, block-on-acknowledge or send-p-messages-synchronously? I thought sending asynchronously means unblocking on ack. Why two attributes are needed?

                    <!--Whether or not we use a blocking call when acknowledging a message-->
                     <block-on-acknowledge>false</block-on-acknowledge>
                     <!--Whether we send persistent messages synchronously-->
                     <send-p-messages-synchronously>true</send-p-messages-synchronously>



                    Thank you very much for the prompt reply.

                    • 7. Re: How the Java client connects to JNDI of JBM 2.0 alpha re
                      clebert.suconic

                      if send-p-messages-synchronously=true -> producer.sendMessage is done synchronously, not waiting for the network roundtrip.

                      if (block-on-acknowledge==true) -> this will affect the confirmation (ACKs) of the messages.