-
1. Re: Is it possible to influence which EJB is called (remote / local)?
jaikiran Sep 6, 2012 5:21 AM (in response to a3aan)1 of 1 people found this helpfulAdriaan, welcome to the forums
Adriaan Wisse wrote:
But... somehow at the moment we are facing the problem that it is not default behaviour that when the same EJB can be found locally and remote it will prefer the local EJB above the remote one. Is this some configuration option or something that we can influence programmatically?
Yes, there's a server side implementation of DeploymentNodeSelector which "prefers" the local server if there are multiple servers which can handle that EJB. There are reasons to do that since if the local server can handle the request there's no need to do the expensive network calls on the remote server. This is the implementation which routes it to the local node https://github.com/jbossas/jboss-as/blob/master/ejb3/src/main/java/org/jboss/as/ejb3/remote/LocalEJBReceiverPreferringDeploymentNodeSelector.java#L31.
If you want to override that behaviour then you can implement your own DeploymentNodeSelector (which selects and returns appropriate node) and then package a jboss-ejb-client.xml in the application and set the deployment-node-selector attribute value to that class name. Here's an example of the xml https://github.com/jbossas/jboss-as/blob/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/client/descriptor/jboss-ejb-client_1_2.xml#L24
-
2. Re: Is it possible to influence which EJB is called (remote / local)?
a3aan Sep 6, 2012 7:11 AM (in response to jaikiran)Hi Jaikiran,
Thanks for your helpful answer. According to your answer I don't need to write our own implementation because the LocalEJBReceiverPreferringDeploymentNodeSelector should exactly do what we need. Or do I misunderstand you?
So I will debug it and find out what goes wrong in our specific case and let you know.
-
3. Re: Is it possible to influence which EJB is called (remote / local)?
a3aan Sep 6, 2012 7:14 AM (in response to jaikiran)Can you tell me in which jar I can find the mentioned class (LocalEJBReceiverPreferringDeploymentNodeSelector)?
-
4. Re: Is it possible to influence which EJB is called (remote / local)?
jaikiran Sep 6, 2012 7:34 AM (in response to a3aan)This wasn't available in AS 7.1.1.Final. You'll need the latest nightly build which contains this fix.
-
5. Re: Is it possible to influence which EJB is called (remote / local)?
a3aan Sep 6, 2012 8:48 AM (in response to jaikiran)Hmm, thats a bit of a problem. Can you give any idea about when a newer version (containing this fix) of JBoss 7 will be released? We will need some stable / final version before the end of october.
-
6. Re: Is it possible to influence which EJB is called (remote / local)?
jaikiran Sep 6, 2012 8:52 AM (in response to a3aan)Adriaan Wisse wrote:
Hmm, thats a bit of a problem. Can you give any idea about when a newer version (containing this fix) of JBoss 7 will be released? We will need some stable / final version before the end of october.
I don't know the date. But there's a stable tag from which you can build this fix https://github.com/jbossas/jboss-as/tree/7.1.2.Final