281.3. 使用
要调用在 RMI registry 中注册的现有 RMI 服务,请创建一个类似如下的路由:
from("pojo:foo").to("rmi://localhost:1099/foo");
from("pojo:foo").to("rmi://localhost:1099/foo");要在 RMI registry 中绑定现有 camel 处理器或服务,请按如下所示定义 RMI 端点:
RmiEndpoint endpoint= (RmiEndpoint) endpoint("rmi://localhost:1099/bar");
endpoint.setRemoteInterfaces(ISay.class);
from(endpoint).to("pojo:bar");
RmiEndpoint endpoint= (RmiEndpoint) endpoint("rmi://localhost:1099/bar");
endpoint.setRemoteInterfaces(ISay.class);
from(endpoint).to("pojo:bar");
					请注意,当绑定 RMI 消费者端点时,您必须指定公开的 远程 接口。
				
在 XML DSL 中,您可以从 Camel 2.7 开始操作:
    <camel:route>
        <from uri="rmi://localhost:37541/helloServiceBean?remoteInterfaces=org.apache.camel.example.osgi.HelloService"/>
        <to uri="bean:helloServiceBean"/>
    </camel:route>
    <camel:route>
        <from uri="rmi://localhost:37541/helloServiceBean?remoteInterfaces=org.apache.camel.example.osgi.HelloService"/>
        <to uri="bean:helloServiceBean"/>
    </camel:route>