Search

Chapter 119. RMI

download PDF

RMI Component

The rmi: component binds Exchanges 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 Exchanges that carry a method invocation from an interface that extends the Remote interface. All parameters in the method should be either Serializable or Remote objects.
Maven users will need to add the following dependency to their pom.xml for this component:
<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>

URI format

rmi://rmi-regisitry-host:rmi-registry-port/registry-path[?options]
For example:
rmi://localhost:1099/path/to/service
You can append query options to the URI in the following format, ?option=value&option=value&...

Options

Name Default Value Description
method null As of Apache Camel 1.3, you can set the name of the method to invoke.
remoteInterfaces null Its now possible to use this option from Camel 2.7: in the XML DSL. It can be a list of interface names separated by comma.

Using

To call out to an existing RMI service registered in an RMI registry, create a route similar to the following:
from("pojo:foo").to("rmi://localhost:1099/foo");
To bind an existing camel processor or service in an RMI registry, define an RMI endpoint as follows:
RmiEndpoint endpoint= (RmiEndpoint) endpoint("rmi://localhost:1099/bar");
endpoint.setRemoteInterfaces(ISay.class);
from(endpoint).to("pojo:bar");
Note that when binding an RMI consumer endpoint, you must specify the Remote interfaces exposed.
In XML DSL you can do as follows from Camel 2.7 onwards:
    <camel:route>
        <from uri="rmi://localhost:37541/helloServiceBean?remoteInterfaces=org.apache.camel.example.osgi.HelloService"/>
        <to uri="bean:helloServiceBean"/>
    </camel:route>
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.