5 Replies Latest reply on Mar 14, 2012 10:32 PM by jaikiran

    enquiry on EJB invocations from remote client using JNDI

    ktfan

      I have a requirement for a client to invoke the EJB services in different servers based on the client application runtime logic.

       

      With reference to this developer guide https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI, we can set up mulitple connections on the jboss-ejb-client.properties and from my reading from other topic, these multiple connections are meant for when connection One is down, the invocation will go to connection Two. What if I need to

      explicitly invoke the connection Two based on the client application runtime logic, how can I do that ?

       

       

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

       

       

      remote.connections=one, two

       

      remote.connection.one.host=localhost

      remote.connection.one.port=6999

      remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

       

      remote.connection.two.host=localhost

      remote.connection.two.port=7999

      remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

        • 1. Re: enquiry on EJB invocations from remote client using JNDI
          ktfan

          I found the system property replacement here :

           

          https://issues.jboss.org/browse/EJBCLIENT-29

           

          Can someone here provide some sample codes on how do handle the system property replacement ?

          • 2. Re: enquiry on EJB invocations from remote client using JNDI
            jaikiran

            The system property replacement will be handled by the library. All you have to do is use the ${systempropertyname} in your property file and then pass the system property using the -Dsystempropertyname=value while starting the application. If you want to specify a default for the system property, so that it will be used in the absence of the system property being set, then just use ${systempropertyname:default-value}. The ":" separates the property name from the default value.

            1 of 1 people found this helpful
            • 3. Re: enquiry on EJB invocations from remote client using JNDI
              ktfan

              Jaikiran Pai, thanks for the tips.

               

              Besides this way, is it possible to change the System Property programatically during execution ?

              • 4. Re: enquiry on EJB invocations from remote client using JNDI
                dmlloyd

                Using system properties is really not the right way to resolve this problem though.

                 

                An EJB is identified by the deployment it is contained in.  If two identical EJBs with the same bean and deployment names are deployed on two systems, and you connect to both systems, the EJBs are considered equivalent and interchangeable.  If you want to assert a non-equivalence between them, you need to introduce what we call a "distinct name" into each EJB deployment, so that they are considered different by the client library.  Then you can create separate proxies for each distinct name and invoke on each one selectively.

                • 5. Re: enquiry on EJB invocations from remote client using JNDI
                  jaikiran

                  David is right (ofcourse) about the use of distinct name. The system property expansion that I mentioned was in reply to your question about EJBCLIENT-29. I missed the fact that you actually had a different question in your first post of this thread.