I'd like to be able to have two Wildfly (or JBoss 7) instances where one of the servers talks to EJBs on the other server. The tricky part is that according to documentation, remote-outbound-connections with outbound-socket-bindings need to be created. This is a big hassle for our Operations team, especially when we want to scale out.
Is there any way for a Wildfly instance to call EJB's on another Wildfly instance by programmatically specifying the remote host?
I've been able to have Tomcat 7 invoke Wildfly EJB's. I added a Maven dependency on org.jboss.as:jboss-as-ejb-client-bom:7.5.0.Final-redhat-21 and set up connection settings according to this documentation.
Thanks!
EDIT
When I try the same code that worked in Tomcat 7 (which uses the jboss-ejb-client library), I get the error EJBCLIENT000021: EJB client context selector may not be changed
when my code tries to do EJBClientContext.setSelector( selector )
. I am setting the remote connection host and port programmatically instead of using jboss-ejb-client.properties.
jgitter's answer got me most of the way there. Here's what I ended up with:
I'm not sure if I need a scoped context, and I may not be closing the connection properly. I'll update this answer based on what I find out.
You don't have to use the remote-outbound-connection. You can just write the code as though you were any external client. See: https://docs.jboss.org/author/display/WFLY9/EJB+invocations+from+a+remote+client+using+JNDI.