JBoss.org Community Documentation

11.1.1. Specifying the EJB Proxy Configuration

To specify the EJB invocation transport and the client proxy interceptor stack, you need to define an invoker-proxy-binding in either the EJB JAR META-INF/jboss.xml descriptor, or the server standardjboss.xml descriptor. There are several default invoker-proxy-bindings defined in the standardjboss.xml descriptor for the various default EJB container configurations and the standard RMI/JRMP and RMI/IIOP transport protocols. The current default proxy configurations are:

  • entity-rmi-invoker : a RMI/JRMP configuration for entity beans

  • clustered-entity-rmi-invoker : a RMI/JRMP configuration for clustered entity beans

  • stateless-rmi-invoker : a RMI/JRMP configuration for stateless session beans

  • clustered-stateless-rmi-invoker : a RMI/JRMP configuration for clustered stateless session beans

  • stateful-rmi-invoker : a RMI/JRMP configuration for clustered stateful session beans

  • clustered-stateful-rmi-invoker : a RMI/JRMP configuration for clustered stateful session beans

  • message-driven-bean : a JMS invoker for message driven beans

  • singleton-message-driven-bean : a JMS invoker for singleton message driven beans

  • message-inflow-driven-bean : a JMS invoker for message inflow driven beans

  • jms-message-inflow-driven-bean : a JMS inflow invoker for standard message driven beans

  • iiop : a RMI/IIOP for use with session and entity beans.

To introduce a new protocol binding, or customize the proxy factory, or the client side interceptor stack, requires defining a new invoker-proxy-binding. The full invoker-proxy-binding DTD fragment for the specification of the proxy configuration is given in Figure 11.2, “The invoker-proxy-binding schema”.

The invoker-proxy-binding schema

Figure 11.2. The invoker-proxy-binding schema


The invoker-proxy-binding child elements are:

  • name : The name element gives a unique name for the invoker-proxy-binding. The name is used to reference the binding from the EJB container configuration when setting the default proxy binding as well as the EJB deployment level to specify addition proxy bindings. You will see how this is done when we look at the jboss.xml elements that control the server side EJB container configuration.

  • invoker-mbean : The invoker-mbean element gives the JMX ObjectName string of the detached invoker MBean service the proxy invoker will be associated with.

  • proxy-factory : The proxy-factory element specifies the fully qualified class name of the proxy factory, which must implement the org.jboss.ejb.EJBProxyFactory interface. The EJBProxyFactory handles the configuration of the proxy and the association of the protocol specific invoker and context. The current JBoss implementations of the EJBProxyFactory interface include:

    • org.jboss.proxy.ejb.ProxyFactory : The RMI/JRMP specific factory.

    • org.jboss.proxy.ejb.ProxyFactoryHA : The cluster RMI/JRMP specific factory.

    • org.jboss.ejb.plugins.jms.JMSContainerInvoker : The JMS specific factory.

    • org.jboss.proxy.ejb.IORFactory : The RMI/IIOP specific factory.

  • proxy-factory-config : The proxy-factory-config element specifies additional information for the proxy-factory implementation. Unfortunately, its currently an unstructured collection of elements. Only a few of the elements apply to each type of proxy factory. The child elements break down into the three invocation protocols: RMI/RJMP, RMI/IIOP and JMS.

For the RMI/JRMP specific proxy factories, org.jboss.proxy.ejb.ProxyFactory and org.jboss.proxy.ejb.ProxyFactoryHA the following elements apply:

  • client-interceptors : The client-interceptors define the home, remote and optionally the multi-valued proxy interceptor stacks.

  • web-class-loader : The web class loader defines the instance of the org.jboss.web.WebClassLoader that should be associated with the proxy for dynamic class loading.

The following proxy-factory-config is for an entity bean accessed over RMI.

<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 call-by-value="false">
				org.jboss.invocation.InvokerInterceptor
				</interceptor>
				<interceptor call-by-value="true">
				org.jboss.invocation.MarshallingInvokerInterceptor
				</interceptor>
				</home>
				<bean>
				<interceptor>org.jboss.proxy.ejb.EntityInterceptor</interceptor>
				<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
				<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
				<interceptor call-by-value="false">
				org.jboss.invocation.InvokerInterceptor
				</interceptor>
				<interceptor call-by-value="true">
				org.jboss.invocation.MarshallingInvokerInterceptor
				</interceptor>
				</bean>
				<list-entity>
				<interceptor>org.jboss.proxy.ejb.ListEntityInterceptor</interceptor>
				<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
				<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
				<interceptor call-by-value="false">
				org.jboss.invocation.InvokerInterceptor
				</interceptor>
				<interceptor call-by-value="true">
				org.jboss.invocation.MarshallingInvokerInterceptor
				</interceptor>
				</list-entity>
				</client-interceptors>
				</proxy-factory-config>
			

For the RMI/IIOP specific proxy factory, org.jboss.proxy.ejb.IORFactory, the following elements apply:

  • web-class-loader : The web class loader defines the instance of the org.jboss.web.WebClassLoader that should be associated with the proxy for dynamic class loading.

  • poa : The portable object adapter usage. Valid values are per-servant and shared.

  • register-ejbs-in-jnp-context : A flag indicating if the EJBs should be register in JNDI.

  • jnp-context : The JNDI context in which to register EJBs.

  • interface-repository-supported : This indicates whether or not a deployed EJB has its own CORBA interface repository.

The following shows a proxy-factory-config for EJBs accessed over IIOP.

<proxy-factory-config>
				<web-class-loader>org.jboss.iiop.WebCL</web-class-loader>
				<poa>per-servant</poa>
				<register-ejbs-in-jnp-context>true</register-ejbs-in-jnp-context>
				<jnp-context>iiop</jnp-context>
				</proxy-factory-config> 
			

For the JMS specific proxy factory, org.jboss.ejb.plugins.jms.JMSContainerInvoker, the following elements apply:

  • MinimumSize : This specifies the minimum pool size for MDBs processing . This defaults to 1.

  • MaximumSize : This specifies the upper limit to the number of concurrent MDBs that will be allowed for the JMS destination. This defaults to 15.

  • MaxMessages : This specifies the maxMessages parameter value for the createConnectionConsumer method of javax.jms.QueueConnection and javax.jms.TopicConnection interfaces, as well as the maxMessages parameter value for the createDurableConnectionConsumer method of javax.jms.TopicConnection. It is the maximum number of messages that can be assigned to a server session at one time. This defaults to 1. This value should not be modified from the default unless your JMS provider indicates this is supported.

  • KeepAliveMillis : This specifies the keep alive time interval in milliseconds for sessions in the session pool. The default is 30000 (30 seconds).

  • MDBConfig : Configuration for the MDB JMS connection behavior. Among the elements supported are:

    • ReconnectIntervalSec : The time to wait (in seconds) before trying to recover the connection to the JMS server.

    • DeliveryActive : Whether or not the MDB is active at startup. The default is true.

    • DLQConfig : Configuration for an MDB's dead letter queue, used when messages are redelivered too many times.

    • JMSProviderAdapterJNDI : The JNDI name of the JMS provider adapter in the java:/ namespace. This is mandatory for an MDB and must implement org.jboss.jms.jndi.JMSProviderAdapter.

    • ServerSessionPoolFactoryJNDI : The JNDI name of the session pool in the java:/ namespace of the JMS provider's session pool factory. This is mandatory for an MDB and must implement org.jboss.jms.asf.ServerSessionPoolFactory.

Example 11.2, “A sample JMSContainerInvoker proxy-factory-config” gives a sample proxy-factory-config fragment taken from the standardjboss.xml descriptor.

<proxy-factory-config>
					<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
					<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
					<MinimumSize>1</MinimumSize>
					<MaximumSize>15</MaximumSize>
					<KeepAliveMillis>30000</KeepAliveMillis>
					<MaxMessages>1</MaxMessages>
					<MDBConfig>
					<ReconnectIntervalSec>10</ReconnectIntervalSec>
					<DLQConfig>
					<DestinationQueue>queue/DLQ</DestinationQueue>
					<MaxTimesRedelivered>10</MaxTimesRedelivered>
					<TimeToLive>0</TimeToLive>
					</DLQConfig>
					</MDBConfig>
					</proxy-factory-config>
				

Example 11.2. A sample JMSContainerInvoker proxy-factory-config