camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache Camel > RMI
Date Sat, 13 Jul 2013 09:10:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/RMI">RMI</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h2. RMI Component <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >The *rmi:* component binds <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">[PojoExchanges|http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/pojo/PojoExchange.html]</span>
<span class="diff-added-words"style="background-color: #dfd;">[Exchange]s</span>
to the RMI protocol (JRMP). <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >Since this binding is just using
RMI, normal RMI rules still apply regarding what methods can be invoked.  This component supports
only <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">[PojoExchanges|http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/pojo/PojoExchange.html]</span>
<span class="diff-added-words"style="background-color: #dfd;">Exchanges</span>
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. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Maven users will need to
add the following dependency to their {{pom.xml}} for this component: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="RMI-RMIComponent"></a>RMI Component</h2>

<p>The <b>rmi:</b> component binds <a href="/confluence/display/CAMEL/Exchange"
title="Exchange">Exchange</a>s to the RMI protocol (JRMP).</p>

<p>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 <a href="http://java.sun.com/j2se/1.3/docs/api/java/rmi/Remote.html"
class="external-link" rel="nofollow">Remote</a> interface.  All parameters in the
method should be either <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html"
class="external-link" rel="nofollow">Serializable</a> or <tt>Remote</tt>
objects.</p>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>
for this component:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
    &lt;artifactId&gt;camel-rmi&lt;/artifactId&gt;
    &lt;version&gt;x.x.x&lt;/version&gt;
    &lt;!-- use the same version as your Camel core version --&gt;
&lt;/dependency&gt;
</pre>
</div></div>

<h3><a name="RMI-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
rmi://rmi-regisitry-host:rmi-registry-port/registry-path[?options]
</pre>
</div></div>

<p>For example:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
rmi://localhost:1099/path/to/service
</pre>
</div></div>

<p>You can append query options to the URI in the following format, <tt>?option=value&amp;option=value&amp;...</tt></p>

<h3><a name="RMI-Options"></a>Options</h3>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>method</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> You can set the name of the method to invoke. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>remoteInterfaces</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> Its now possible to use this option from <b>Camel 2.7:</b>
in the XML DSL. It can be a list of interface names separated by comma. </td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="RMI-Using"></a>Using</h3>

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

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
from("pojo:foo").to("rmi://localhost:1099/foo");
</pre>
</div></div>

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

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
RmiEndpoint endpoint= (RmiEndpoint) endpoint("rmi://localhost:1099/bar");
endpoint.setRemoteInterfaces(ISay.class);
from(endpoint).to("pojo:bar");
</pre>
</div></div>

<p>Note that when binding an RMI consumer endpoint, you must specify the <tt>Remote</tt>
interfaces exposed.</p>

<p>In XML DSL you can do as follows from <b>Camel 2.7</b> onwards:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
    &lt;camel:route&gt;
        &lt;from uri="rmi://localhost:37541/helloServiceBean?remoteInterfaces=org.apache.camel.example.osgi.HelloService"/&gt;
        &lt;to uri="bean:helloServiceBean"/&gt;
    &lt;/camel:route&gt;
</pre>
</div></div>

<h3><a name="RMI-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CAMEL">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/RMI">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=53040&revisedVersion=12&originalVersion=11">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/RMI?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message