camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > RMI
Date Mon, 29 Mar 2010 01:24:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/RMI">RMI</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~njiang">willem
jiang</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="RMI-RMIComponent"></a>RMI Component</h2>

<p>The <b>rmi:</b> component binds <a href="http://activemq.apache.org/camel/maven/camel-core/apidocs/org/apache/camel/component/pojo/PojoExchange.html"
rel="nofollow">PojoExchanges</a> 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 <a href="http://activemq.apache.org/camel/maven/camel-core/apidocs/org/apache/camel/component/pojo/PojoExchange.html"
rel="nofollow">PojoExchanges</a> 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" 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"
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="code-java">
&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="code-java">
rmi:<span class="code-comment">//rmi-regisitry-host:rmi-registry-port/registry-path[?options]</span>
</pre>
</div></div>

<p>For example:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
rmi:<span class="code-comment">//localhost:1099/path/to/service</span>
</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>

<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'> As of <b>Camel 1.3</b>, you can set the name of
the method to invoke. </td>
</tr>
</tbody></table>

<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="code-java">
from(<span class="code-quote">"pojo:foo"</span>).to(<span class="code-quote">"rmi:<span
class="code-comment">//localhost:1099/foo"</span>);</span>
</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="code-java">
RmiEndpoint endpoint= (RmiEndpoint) endpoint(<span class="code-quote">"rmi:<span
class="code-comment">//localhost:1099/bar"</span>);
</span>endpoint.setRemoteInterfaces(ISay.class);
from(endpoint).to(<span class="code-quote">"pojo:bar"</span>);
</pre>
</div></div>

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

<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;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CAMEL/RMI">View Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=53040&revisedVersion=7&originalVersion=6">View
Change</a>
              |
       <a href="http://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