1 Reply Latest reply on Jun 6, 2014 1:54 PM by Wolf-Dieter Fink

    EJB invocation on particular cluster node

    Marcel Šebek Newbie

      For some reasons, I want to call singleton EJB on particular cluster node (known by its name at the moment of call). I think this is quite reasonable requirement, since singletons in cluster environment are special type of objects. One usage pattern is in coordination with cluster-wide singleton - the service provide you currently selected node name, but now direct way how to call it. But this is not the only situation, one may want to manually manage some resource distribution across singletons in the cluster (eg. from a cluster-wide singleton).

       

      With current api, choosing the destination node of ejb call seems impossible. I managed to get the result by slight modification of jboss-ejb-client library, namely by adding a constructor of StatelessEJBLocator with affinity parameter. Then, the call on specific node can be performed in the following way:

       

      EJBLocator<MyRemoteInterface> loc = new StatelessEJBLocator<>(MyRemoteInterface.class, "appname", "modulename", "BeanName", "", new NodeAffinity("mynodename"));
      return EJBClient.createProxy(loc);

       

      I don't know if this is change acceptable for upstream. Do you like it? It is not a problem to fill a JIRA report of make a pull request.

       

      created a JIRA and pull request: https://issues.jboss.org/browse/EJBCLIENT-107

       

      Message was edited by: Marcel Šebek