12 Replies Latest reply on Oct 9, 2012 3:05 PM by sujes

    How to programatically manage 1,000 to 6,000 outbound ejb connections in JBoss7?

    James MacDonald Newbie

      My use case is that I have a central Jboss 7 server, or possibly a cluster that acts as a central location.  I also have up to 6,000 remote locations.  Each of these locations has an ejb with a remote interface exported in JNDI.  Let's call it ejb:/RemoteAPP/remote-api// ... some EJB etc.


      The central server needs to connect to all these remote ejb's (one after another) and read information unique to each remote location.  Say statistics for example.


      In Jboss 4,5,6 this was easy, we would use an InitialContext, and pass it a URL with a different IP:PORT.  This has worked sufficiently for years.  But we want to move to Jboss 7.


      So it seems in Jboss 7, you are suppose to... set up 6,000 outbound connections using the jboss-cli interface? manually adding them to your standalone.xml?  Seems untennable to me.  There must be a betteer way.  I realize there might be a clustering answer in here, but my use case is specific, please keep reading.


      At any time, remote sites can come online, or offline.  We don't want to have to restart our central server to become aware of these new outbound connections.  Currently, we manage all this connection information in an SQL database in an automated fashion.  With previous versions of Jboss we simply read it out, create our InitialContext with our URL that has a PORT and IP and everyone is happy (regardless of wether this is actually the correct way to do it).


      So in Jboss 7 I am trying to figure out how to manage this.  I am currenly using 7.1.2 tag that I compiled.  I have also worked on this scenario in Jboss 7.1.1.


      I tried setting up a few Jboss7 server to server outbound connections in standalone.xml.  What I observed is that when I lookup up my ejb:/RemoteAPP/remote-api// app, the Receiver would get stuck on the first one it found.  I could not switch between remote servers 1, 2 or 3.  So ok, I thought there must be away around this.  I read about setting the selector and creating jboss-ejb-client.properties programtically.  Oh but you can't change the selector when running inside the container because it throws a security exception.  The selector is locked.


      I think the we are going to look at changing the application name in the application.xml or, set the distinctName globally for each remote node to deal with this issue.  However I would still have two remaning issues.


      • Firstly, How how can I programatically manage thousands of outbound-socket-binding's and remote-outbound-connection's, sometimes coming online new, or being removed, without restarting the central server(s)?  I don't think putting 1,000 or more outbound-socket-binding's and remote-outbound-connection's in the standalone.xml is tennable.  I have to use the database as a source to manage this information.
      • Secondly, even if I can find a way to manage outbound-socket-binding's and remote-outbound-connectio'sn programatically, how can I getaway without making thousands of entries in the jboss-ejb-client.xml of my application ear that lives on the centra server(s).  Perhaps I can interface withs omething that lets me publish these remote connections dynamically in the global jndi namespace as they come and go?


      So what are my options?  Some kind of Management APi to create outbound-socket-binding's and remote-outbound-connection's dynaimically?  Does one exist?  A plugin that can boot strap the outbound connection information from an implementation I could write and then reads from our database?  Some kind of clustering configuration where I have fine grain control on each lookup or invocation which target remote server will be used to execute an EJB call?


      I would appreciate any feedback on how to solve this use case in Jboss7.