JNDI Bindings and Multiple Transports
By default, session beans will bind to JNDI under the fully qualified name of their local and/or remote interface. You can override this behavior by defining your own @org.jboss.annotation.ejb.LocalBinding or @org.jboss.annotation.ejb.RemoteBinding.
Local Interface JNDI Binding.
To change the JNDI name for your local interface use the org.jboss.annotation.ejb.LocalBinding annotation.
@Stateless @LocalBinding(jndiBinding="custom/MySession") public class MySessionBean implements MySession { }
Remote Interface JNDI Binding
To change the JNDI name for your remote interface use the org.jboss.annotation.ejb.RemoteBinding annotation.
@Stateless @RemoteBindings({@RemoteBinding(jndiBinding="custom/remote/MySession")}) public class MySessionBean implements MySession { }
Multiple transports and Client Interceptors
You can expose a Session bean remoting through multiple transports using the JBoss Remoting framework. Currently only a few plugins are available. Check out the JBoss Remoting Document on how to define the transport MBean. To expose a Session Bean through multiple transports, again you would use the RemoteBinding annotations.
public @interface RemoteBinding { String jndiBinding() default ""; String interceptorStack() default "SessionBeanClientInterceptors"; String clientBindUrl(); Class factory() default org.jboss.ejb3.remoting.RemoteProxyFactory.class; }
jndiBinding specifies the jndi name the proxy will be bound to.
interceptorStack allows you to plug in a JBoss AOP <stack>. SessionBeanClientInterceptors stack can be found in ejb3-interceptors-aop.xml file in your deploy directory.
clientBindUrl defines the JBoss Remoting URI that the client will use to bind to the server.
factory allows you to plug in your own proxy factory for beans. You usually do not have to touch this setting.
Here is an example:
@Stateless @RemoteBindings({ @RemoteBinding(jndiName="custom/remote/MySession", interceptorStack="MyInterceptorStack", clientBindUrl="socket://foo.jboss.org:2222") }) public class MySessionBean implements MySession { }
Referenced by:
Comments