2 Replies Latest reply on Sep 7, 2012 8:30 AM by wesjanik

    Programmatically Determining Remoting Config

    wesjanik

      Hi Everyone-

       

      Does anyone know if there is a way to programmatically determine the remoting configuration of a running AS7 cluster node (i.e. from an EJB)?  Much like the discussion on calling remote EJBs without a properties file (https://community.jboss.org/thread/177302), I'm looking for a way to connect to specific nodes in a cluster individually.  Based on that discussion, it looks like my only option is to use remote naming as described here: https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project

       

      The problem is, I'd like a way for the nodes of the cluster to discover their connection (host & port) info to publish to the other nodes.  I'm trying to avoid any node-specific configuration.  Does anyone know of a good way to do this?  If that configuration seems impractical, does anyone know of a way to trade around some sort of proxy tied to a specific node?

       

      Thanks,

         -Wes

        • 1. Re: Programmatically Determining Remoting Config
          jaikiran

          Wesley Janik wrote:

           

           

          The problem is, I'd like a way for the nodes of the cluster to discover their connection (host & port) info to publish to the other nodes. 

          I don't fully understand your use case. Why do you want to publish the cluster node information from within your application?

          • 2. Re: Programmatically Determining Remoting Config
            wesjanik

            Thanks for your prompt reply - I probably should have said what my end goal was .  I'm trying to build a clustered singleton I can "talk to" (i.e. invoke methods on) similar to what's being discussed here https://community.jboss.org/message/745512#745512.  What I'd ideally like to do is return some kind of EJB proxy that's hard-wired to talk to the node that constructed it.  In this case, that would be the node the singleton is elected to run on.  From what I understand, the best (only?) way to construct one of these proxies in a thread-safe way is using remote JNDI.  I was figuring I could have the singleton service 'getValue' method return information on the node location, then construct an InitialContext to point to it.

             

            Granted there are problems with this approach (most notably a new node could be elected between when the location information is retrieved and the EJB method invoked), but one thing at a time.  Even more ideal would be the ability to pass arguments to the 'getValue' method and proxy the invocation through the singleton service to a local EJB, but from what I understand that's not possible.