<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:rmi="http://www.mulesoft.org/schema/mule/rmi"
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/rmi http://www.mulesoft.org/schema/mule/rmi/3.3/mule-rmi.xsd">
<!-- specify the actual class of the JNDI factory you want to use -->
<spring:bean name="jndiFactory" class="org.mule.transport.rmi.MuleRMIFactory"/>
<spring:bean name="jndiContext" factory-bean="jndiFactory" factory-method="create"/>
<rmi:connector name="rmi" jndiContext-ref="jndiContext" securityPolicy="rmi.policy"/>
<rmi:endpoint name="hello" host="localhost" port="1099" object="HelloServer"
method="hello" methodArgumentTypes="java.lang.String"/>
RMI Transport Reference
The RMI transport can be used to send and receive Mule events over JRMP. This transport has a dispatcher that invokes an RMI method and a polling receiver that repeatedly does the same.
You configure the RMI transport as follows:
The connector looks for the method
and methodArgumentTypes
. It uses the payload as the argument.
Note: In these code examples, spring-beans-current.xsd
is a placeholder. To locate the correct version, see http://www.springframework.org/schema/beans/.
JNP Connector
If you want to use the Java naming protocol to bind to remote objects, you can use the JNP connector instead simply by using the jnp
namespace.
<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:jnp="http://www.mulesoft.org/schema/mule/jnp"
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/jnp http://www.mulesoft.org/schema/mule/jnp/3.3/mule-jnp.xsd">
<!-- specify the actual class of the JNDI factory you want to use -->
<spring:bean name="jndiFactory" class="org.mule.transport.rmi.MuleRMIFactory"/>
<spring:bean name="jndiContext" factory-bean="jndiFactory" factory-method="create"/>
<jnp:connector name="jnp" jndiContext-ref="jndiContext" securityPolicy="rmi.policy"/>
<jnp:endpoint name="Sender2" host="localhost" port="1099" object="MatchingUMO" method="reverseString"/>
...
Connector
Attributes of <connector…>
Name | Type | Required | Default | Description |
---|---|---|---|---|
pollingFrequency |
long |
no |
Period (ms) between polling connections. |
|
securityManager-ref |
string |
no |
Bean reference to the security manager that should be used. |
|
securityPolicy |
string |
no |
The security policy (file name) used to enable connections. |
|
serverClassName |
string |
no |
The target class name. |
|
serverCodebase |
string |
no |
The target method. |
Endpoint
Attributes of <endpoint…>
Name | Type | Required | Default | Description |
---|---|---|---|---|
host |
string |
no |
The endpoint host name. |
|
port |
port number |
no |
The port number to use when a connection is made. |
|
object |
string |
no |
The class name of the object that is being invoked over RMI. |
|
method |
string |
no |
The name of the method to invoke. |
|
methodArgumentTypes |
string |
no |
Comma separated argument types of the method to invoke. For example, "java.lang.String". |