Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
h2. RMI Component

The *rmi:* component binds [PojoExchanges|http://activemqcamel.apache.org/camelmaven/mavencurrent/camel-core/apidocs/org/apache/camel/component/pojo/PojoExchange.html] to the RMI protocol (JRMP).

Since this binding is just using RMI, normal RMI rules still apply regarding what methods can be invoked.  This component supports only [PojoExchanges|http://activemqcamel.apache.org/camelmaven/mavencurrent/camel-core/apidocs/org/apache/camel/component/pojo/PojoExchange.html] that carry a method invocation from an interface that extends the [Remote|http://java.sun.com/j2se/1.3/docs/api/java/rmi/Remote.html] interface.  All parameters in the method should be either [Serializable|http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html] or {{Remote}} objects.

Maven users will need to add the following dependency to their {{pom.xml}} for this component:
{code:xml}
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-rmi</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>
{code}

h3. URI format

{code}
rmi://rmi-regisitry-host:rmi-registry-port/registry-path[?options]
{code}

For example:

{code}
rmi://localhost:1099/path/to/service
{code}

You can append query options to the URI in the following format, {{?option=value&option=value&...}}

h3. Options
{div:class=confluenceTableSmall}
|| Name || Default Value || Description ||
| {{method}} | {{null}} | As of *Camel 1.3*, you can set the name of the method to invoke. |
{div}

h3. Using

To call out to an existing RMI service registered in an RMI registry, create a route similar to the following:

{code:java}
from("pojo:foo").to("rmi://localhost:1099/foo");
{code}

To bind an existing camel processor or service in an RMI registry, define an RMI endpoint as follows:

{code:java}
RmiEndpoint endpoint= (RmiEndpoint) endpoint("rmi://localhost:1099/bar");
endpoint.setRemoteInterfaces(ISay.class);
from(endpoint).to("pojo:bar");
{code}

Note that when binding an RMI consumer endpoint, you must specify the {{Remote}} interfaces exposed.

{include:Endpoint See Also}