Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

EJB Transport Reference

The Enterprise Java Beans (EJB) transport allows EJB session beans to be invoked as part of an event flow. Components can be given an EJB outbound endpoint, which invokes the remote object and optionally returns a result.

Connector

The Mule EJB Connector provides connectivity for EJB beans.

Table 1. Attributes of <connector…​>
Name Type Required Default Description

pollingFrequency

long

no

Period (ms) between polling connections.

securityManager-ref

name (no spaces)

no

Bean reference to the security manager that should be used.

securityPolicy

string

no

The security policy (file name) used to enable connections.

serverClassName

name (no spaces)

no

The target class name.

serverCodebase

string

no

The target method.

For example:


         
      
1
<ejb:connector name="ejb" jndiContext-ref="jndiContext" securityPolicy="rmi.policy" />

Using the EJB Transport

To use the EJB transport, you must define the EJB namespace and schema location at the top of the Mule configuration file. For example:


         
      
1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:ejb="http://www.mulesoft.org/schema/mule/ejb"
       xsi:schemaLocation="
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
               http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd
               http://www.mulesoft.org/schema/mule/ejb http://www.mulesoft.org/schema/mule/ejb/3.3/mule-ejb.xsd">
...

Note: In this code example, spring-beans-current.xsd is a placeholder. To locate the correct version, see http://www.springframework.org/schema/beans/.

EJB endpoints are configured the same way as RMI endpoints. Note that only outbound endpoints can use the EJB transport. For a given endpoint, you must provide the following information:

  • Registry host

  • Registry port

  • Remote home name

  • Remote method name

These values are used to establish the dispatcher connection. For example:


         
      
1
<ejb:endpoint host="localhost" port="1099" object="SomeService" method="remoteMethod"/>

Alternatively, you could use URI-based configuration:


         
      
1
<outbound-endpoint address="ejb://localhost:1099/SomeService?method=remoteMethod"/>

If the method can take one or more input arguments, you configure their types as a comma-separated list using the methodArgumentTypes attribute. Multiple arguments are passed in as an array of objects as the payload of the Mule message.

Transformers

No specific transformers are required for EJB.