2 Replies Latest reply on Sep 2, 2014 7:11 AM by wdfink

    EJB Communication Across Multiple Servers

    stuartw

      Hello,

       

      I currently have an application which requires to target multiple different instances of another application, based on decisions within my code. Using JBoss 5.1.0 this works very well, as I can simply create an InitialContext with the java.naming.provider.url set to point at the server (or cluster) I want. I have now been trying to achieve the same results with Wildfly, but so far I have not been successful. I have had a look at the quickstart ejb-multi-server, but the targeted applications both have different names in this example, whereas in my case they all have the same name. Has anybody managed to get something similar working?

       

      Just to clarify, in JBoss 5.1.0 I was doing something like this:

       

      Properties env = new Properties();

      if (route call to cluster A based on some decision) {

          env.setProperty(Context.PROVIDER_URL, "servera1:1100,servera2:1100");

      } else { // route call to cluster B

          env.setProperty(Context.PROVIDER_URL, "serverb1:1100,serverb2:1100");

      }

      Context ctx = new InitialContext(env);

      ctx.lookup("my-app/my-ejb/MySessionBean");

       

      But now that I need to set-up the outbound-socket-binding in the server configuration file I can't see how I can achieve the same results. I know that I can set-up multiple outbound-socket-binding entries, but I can't work out how I can chose which one to use at run-time.

       

      Many thanks,

      Stuart