JBoss 3.1 (CVS-HEAD) now has the ability to bind multiple invokers per EJB
container. This means that one EJB container can serve up requests from
IIOP, RMI, SOAP, <your-protocol-here> all at the same time. Also, if your
EJBs are configured correctly in jboss.xml Beans accessed through bean
ejb-refs will automatically and transparently use the correct protocol.
Meaning, if you start off on IIOP, you'll stay on IIOP (unless the call is
colocated).
There have been some fundamental changes to configuration:
1. <container-configuration> no longer has client-interceptors defined
within it. A new invoker to proxy factory binding has the
client-interceptor definitions for each proxyfactory/invoker binding combo.
2. Also, <container-invoker> configuration tag has been removed from
<container-configuration>.
3. jdk1.2.2 support has been removed from standardjboss.xml
4. THere are no more Clustered <container-configuration> definitions in
standardjboss.xml. They're no longer needed
Let's take a look at the new standardjboss.xml:
<jboss>
<invoker-proxy-bindings>
<invoker-proxy-binding>
<name>entity-rmi-invoker</name>
<invoker-mbean>jboss:service=invoker,type=jrmp</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
<proxy-factory-config>
<client-interceptors>
<home>
<interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>
<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</home>
<bean>
<interceptor>org.jboss.proxy.ejb.EntityInterceptor</interceptor>
<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</bean>
<list-entity>
<interceptor>org.jboss.proxy.ejb.ListEntityInterceptor</interceptor>
<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</list-entity>
</client-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
...
The invoker-proxy-binding is a description of the binding between an Invoker
and the EJB proxy factory. It also contains the Proxy Factory's
configuration. For RMI ejbs, proxy-factory-config contains a list of
client-interceptors. If you look at the message-driven-bean
invoker-proxy-factory binding, you'll see that the proxy-factory-config
contains configuration for setting up JMS.
<invoker-proxy-binding>
<name>message-driven-bean</name>
<invoker-mbean>default</invoker-mbean>
<proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
<proxy-factory-config>
<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
<MaximumSize>15</MaximumSize>
<MaxMessages>1</MaxMessages>
<Optimized>True</Optimized>
<MDBConfig>
<ReconnectIntervalSec>10</ReconnectIntervalSec>
<DLQConfig>
<DestinationQueue>queue/DLQ</DestinationQueue>
<MaxTimesRedelivered>10</MaxTimesRedelivered>
<TimeToLive>0</TimeToLive>
</DLQConfig>
</MDBConfig>
</proxy-factory-config>
</invoker-proxy-binding>
Now, to actually see what the new multi-invokers can do, take a look at
.../testsuite/src/main/org/jboss/test/invokers and
.../testsuite/src/resources/invokers/META-INF.
Let's examine the ejb-jar.xml file and jboss.xml file for this test in the t
estsuite.
ejb-jar.xml:
<entity>
<description>a simple bean managed entity bean</description>
<ejb-name>SimpleBMP</ejb-name>
<home>org.jboss.test.invokers.interfaces.SimpleBMPHome</home>
<remote>org.jboss.test.invokers.interfaces.SimpleBMP</remote>
<ejb-class>org.jboss.test.invokers.ejb.SimpleBMPBean</ejb-class>
<prim-key-class>java.lang.Integer</prim-key-class>
<persistence-type>Bean</persistence-type>
<transaction-type>Container</transaction-type>
<reentrant>false</reentrant>
</entity>
<session>
<description>A trival echo stateless session bean</description>
<ejb-name>StatelessSession</ejb-name>
<home>org.jboss.test.invokers.interfaces.StatelessSessionHome</home>
<remote>org.jboss.test.invokers.interfaces.StatelessSession</remote>
<ejb-class>org.jboss.test.invokers.ejb.StatelessSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/SimpleBMP</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>org.jboss.test.invokers.interfaces.SimpleBMPHome</home>
<remote>org.jboss.test.invokers.interfaces.SimpleBMP</remote>
</ejb-ref>
</session>
You see that there are 2 beans defined. A BMP entity bean "SimpleBMP" and a
stateless session EJB "StatelessSession" that has an <ejb-ref> to the
"SimpleBMP"
Let's now look at jboss.xml.
<invoker-proxy-bindings>
<invoker-proxy-binding>
<name>entity-compression-invoker</name>
<invoker-mbean>jboss:service=invoker,type=jrmp,socketType=CompressionSocketF
actory</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
<proxy-factory-config>
<client-interceptors>
<home>
<interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>
<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</home>
<bean>
<interceptor>org.jboss.proxy.ejb.EntityInterceptor</interceptor>
<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</bean>
</client-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
<invoker-proxy-binding>
<name>stateless-compression-invoker</name>
<invoker-mbean>jboss:service=invoker,type=jrmp,socketType=CompressionSocketF
actory</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
<proxy-factory-config>
<client-interceptors>
<home>
<interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>
<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</home>
<bean>
<interceptor>org.jboss.proxy.ejb.StatelessSessionInterceptor</interceptor>
<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</bean>
</client-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
</invoker-proxy-bindings>
First in jboss.xml you'll see 2 new invoker-proxy-bindings defined.
"entity-compression-invoker" and "stateless-compression-invoker". THese are
bindings to a new JRMPInvoker "CompressionSocketFactory". Basically the
invoker is a RMI server with Customer sockets. THe custom sockets gzip the
request before sending it across the wire. jboss.xml continues to define
the EJBs and the relationships these beans have to various invokers:
<enterprise-beans>
<entity>
<ejb-name>SimpleBMP</ejb-name>
<invoker-bindings>
<invoker>
<invoker-proxy-binding-name>entity-compression-invoker</invoker-proxy-bindin
g-name>
<jndi-name>CompressionSimpleBMP</jndi-name>
</invoker>
<invoker>
<invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
<jndi-name>SimpleBMP</jndi-name>
</invoker>
</invoker-bindings>
</entity>
The configuration above shows how you can allow an EJB to be served up by
multiple different invokers. You must describe each invoker the EJB will
deploy with. For each invoker-binding you define, a HOME proxy will be
created that is attached to the invoker under the jndi-name for each invoker
you define. 2 homes will be bound to JNDI "CompressionSimpleBMP" and
"SimpleBMP"
Let's continue:
<session>
<ejb-name>StatelessSession</ejb-name>
<invoker-bindings>
<invoker>
<invoker-proxy-binding-name>stateless-compression-invoker</invoker-proxy-bin
ding-name>
<jndi-name>CompressionStatelessSession</jndi-name>
<ejb-ref>
<ejb-ref-name>ejb/SimpleBMP</ejb-ref-name>
<jndi-name>CompressionSimpleBMP</jndi-name>
</ejb-ref>
</invoker>
<invoker>
<invoker-proxy-binding-name>stateless-rmi-invoker</invoker-proxy-binding-nam
e>
<jndi-name>StatelessSession</jndi-name>
<ejb-ref>
<ejb-ref-name>ejb/SimpleBMP</ejb-ref-name>
<jndi-name>SimpleBMP</jndi-name>
</ejb-ref>
</invoker>
</invoker-bindings>
</session>
The "StatelessSession" bean works basically the same as the SimpleBMP as far
as describing multiple invokers. You'll see <ejb-ref>s can be described for
each invoker binding. So, if you invoke on a Compression StatelessSession
and access a SimpleBMP, the SimpleBMP you get back will be a Compression
SimpleBMP. All seemless. If you do not have to define <ejb-ref> for each
invoker, for instance, you could do this instead:
<session>
<ejb-name>StatelessSession</ejb-name>
<invoker-bindings>
<ejb-ref>
<ejb-ref-name>ejb/SimpleBMP</ejb-ref-name>
<jndi-name>CompressionSimpleBMP</jndi-name>
</ejb-ref>
<invoker>
<invoker-proxy-binding-name>stateless-compression-invoker</invoker-proxy-bin
ding-name>
<jndi-name>CompressionStatelessSession</jndi-name>
</invoker>
<invoker>
<invoker-proxy-binding-name>stateless-rmi-invoker</invoker-proxy-binding-nam
e>
<jndi-name>StatelessSession</jndi-name>
</invoker>
</invoker-bindings>
</session>
Also, you do not have to define <invoker-bindings> for all your EJBs now.
There is a default for each entity bean type. This applies to clustering as
well.
Some class name changes:
ContainerInvoker.java -> EJBProxyFactory.java
ContainerInvokerContainer.java -> EJBProxyFactoryContainer.java
LocalContainerInvoker.java -> LocalProxyFactory.java
BasicLocalContainerInvoker.java -> BasicLocalProxyFactory.java
Well, that's about it. Hope you like it! Hope it doesn't cause too many
new problems :)
Regards,
Bill
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development