camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Camel CXF Design
Date Wed, 07 Mar 2012 14:53:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/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/Camel+CXF+Design">Camel
CXF Design</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        use real URL's so the export generates usable links<br />
    </div>
        <br/>
                         <h4>Changes (4)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h3. CXFConsumer <br>[CXFConsumer|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java]
works as the CXF server, so we create the CXF server with the [CXFEndpoint|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java]
which holds the cxf endpoint information such as SEI class, wsdl location, service name and
endpoint name etc. You can configure the cxf endpoint according to this [schema|https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd]
in spring. <br></td></tr>
            <tr><td class="diff-changed-lines" >Now we just leverage the CXF&#39;s
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">[invoker|CXF20DOC:Invokers]</span>
<span class="diff-added-words"style="background-color: #dfd;">[invoker|http://cxf.apache.org/docs/invokers.html]</span>
to override the default invoker by setting a [CamelInvoker|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java]
to the <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">[ServerFactoryBean|CXF20DOC:Server,
Service, and Client FactoryBeans].</span> <span class="diff-added-words"style="background-color:
#dfd;">[ServerFactoryBean|http://cxf.apache.org/docs/server-service-and-client-factorybeans.html].</span>
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. CXFProducer <br></td></tr>
            <tr><td class="diff-changed-lines" >CXF <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">[Client|CXF20DOC:Server,
Service, and Client FactoryBeans]</span> <span class="diff-added-words"style="background-color:
#dfd;">[Client|http://cxf.apache.org/docs/server-service-and-client-factorybeans.html]</span>
is used to send out the incoming message from the [CXFProducer|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java]
and pass the response back. <br></td></tr>
            <tr><td class="diff-unchanged" >To support the client which just sends
the stream request , we write the [CxfClient|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClient.java]
and [CxfClientFactoryBean|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClientFactoryBean.java].
<br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >camel-cxf component supports to handle
the CXF message with different [DataFormat|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java].
<br> <br></td></tr>
            <tr><td class="diff-changed-lines" >To get the best reuse of the CXF
generic message layer, we use the CXF <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">[feature|CXF20DOC:Features]</span>
<span class="diff-added-words"style="background-color: #dfd;">[feature|http://cxf.apache.org/docs/features.html]</span>
API to setup the interceptors for different types message handling. <br></td></tr>
            <tr><td class="diff-unchanged" >{code:java} <br>if (!dataFormat.equals(DataFormat.POJO)...)
{ <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. Binding the conduit
and destination with the context endpoint  <br></td></tr>
            <tr><td class="diff-changed-lines" >As [CXF transport <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">API|CXF20DOC:CXF
Architecture]</span> <span class="diff-added-words"style="background-color: #dfd;">API|http://cxf.apache.org/docs/cxf-architecture.html]</span>
side, CXF transport API includes [Conduit|http://svn.apache.org/repos/asf/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Conduit.java]
and [Destination|http://svn.apache.org/repos/asf/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Destination.java]
that we need to implement with Camel. <br></td></tr>
            <tr><td class="diff-unchanged" >We use the the [CamelTemplate|http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelTemplate.html]
to send out the message for a certain endpoint in the [CamelConduit|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java],
and bind a consumer process for the [CamelDestination|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java].
  <br>When you specify the endpoint URI that start with camel in [CamelConduit|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java]
or [CamelDestination|http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java]
the endpoint address, Camel transport will bind it to the endpoint which is in the [CamelContext|http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html].
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="CamelCXFDesign-CamelCXFDesign"></a>Camel CXF Design</h1>

<h2><a name="CamelCXFDesign-IntegratingCXFintoCamel"></a>Integrating CXF
into Camel</h2>

<p>Camel provides a component API , after defined the <a href="/confluence/display/CAMEL/CXF"
title="CXF">endpoint URI format</a>,  we just need implement the Camel component
API by using CXF as a library to create the client and server for camel-cxf component's consumer
and producer.</p>

<h3><a name="CamelCXFDesign-CXFConsumer"></a>CXFConsumer</h3>
<p><a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java"
class="external-link" rel="nofollow">CXFConsumer</a> works as the CXF server, so
we create the CXF server with the <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java"
class="external-link" rel="nofollow">CXFEndpoint</a> which holds the cxf endpoint
information such as SEI class, wsdl location, service name and endpoint name etc. You can
configure the cxf endpoint according to this <a href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd"
class="external-link" rel="nofollow">schema</a> in spring.<br/>
Now we just leverage the CXF's <a href="http://cxf.apache.org/docs/invokers.html" class="external-link"
rel="nofollow">invoker</a> to override the default invoker by setting a <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java"
class="external-link" rel="nofollow">CamelInvoker</a> to the <a href="http://cxf.apache.org/docs/server-service-and-client-factorybeans.html"
class="external-link" rel="nofollow">ServerFactoryBean</a>.</p>

<h3><a name="CamelCXFDesign-CXFProducer"></a>CXFProducer</h3>
<p>CXF <a href="http://cxf.apache.org/docs/server-service-and-client-factorybeans.html"
class="external-link" rel="nofollow">Client</a> is used to send out the incoming
message from the <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java"
class="external-link" rel="nofollow">CXFProducer</a> and pass the response back.
<br/>
To support the client which just sends the stream request , we write the <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClient.java"
class="external-link" rel="nofollow">CxfClient</a> and <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClientFactoryBean.java"
class="external-link" rel="nofollow">CxfClientFactoryBean</a>.</p>

<h3><a name="CamelCXFDesign-DataFormat"></a>DataFormat</h3>
<p>camel-cxf component supports to handle the CXF message with different <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java"
class="external-link" rel="nofollow">DataFormat</a>.</p>

<p>To get the best reuse of the CXF generic message layer, we use the CXF <a href="http://cxf.apache.org/docs/features.html"
class="external-link" rel="nofollow">feature</a> API to setup the interceptors for
different types message handling.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">if</span> (!dataFormat.equals(DataFormat.POJO)...)
{
   List&lt;AbstractFeature&gt; features = <span class="code-keyword">new</span>
ArrayList&lt;AbstractFeature&gt;();
   <span class="code-comment">// adding the logging feature here <span class="code-keyword">for</span>
debug
</span>   features.add(<span class="code-keyword">new</span> LoggingFeature());

   <span class="code-keyword">if</span> (dataFormat.equals(DataFormat.PAYLOAD))
{
       features.add(<span class="code-keyword">new</span> PayLoadDataFormatFeature());
      
   }
   
   <span class="code-keyword">if</span> (dataFormat.equals(DataFormat.MESSAGE))
{
       features.add(<span class="code-keyword">new</span> MessageDataFormatFeature());
   }
   
  <span class="code-comment">// set the feature to the ServerFactoryBean or ClientFactoryBean

</span>  ...
}

</pre>
</div></div>


<h2><a name="CamelCXFDesign-IntegrateCamelintoCXF"></a>Integrate Camel into
CXF</h2>
<p>Currently , we introduce <a href="/confluence/display/CAMEL/Camel+Transport+for+CXF"
title="Camel Transport for CXF">Camel Transport for CXF</a> to integrate the Camel
as an transport library in CXF. </p>

<h3><a name="CamelCXFDesign-Bindingtheconduitanddestinationwiththecontextendpoint"></a>Binding
the conduit and destination with the context endpoint </h3>
<p>As <a href="http://cxf.apache.org/docs/cxf-architecture.html" class="external-link"
rel="nofollow">CXF transport API</a> side, CXF transport API includes <a href="http://svn.apache.org/repos/asf/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Conduit.java"
class="external-link" rel="nofollow">Conduit</a> and <a href="http://svn.apache.org/repos/asf/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Destination.java"
class="external-link" rel="nofollow">Destination</a> that we need to implement with
Camel.<br/>
We use the the <a href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelTemplate.html"
class="external-link" rel="nofollow">CamelTemplate</a> to send out the message for
a certain endpoint in the <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java"
class="external-link" rel="nofollow">CamelConduit</a>, and bind a consumer process
for the <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java"
class="external-link" rel="nofollow">CamelDestination</a>.  <br/>
When you specify the endpoint URI that start with camel in <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java"
class="external-link" rel="nofollow">CamelConduit</a> or <a href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java"
class="external-link" rel="nofollow">CamelDestination</a> the endpoint address, Camel
transport will bind it to the endpoint which is in the <a href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html"
class="external-link" rel="nofollow">CamelContext</a>.</p>

<p>Here are some <a href="/confluence/display/CAMEL/CXF+Example" title="CXF Example">examples</a>
of configuring the Camel transport.</p>


    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Camel+CXF+Design">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=78749&revisedVersion=7&originalVersion=6">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Camel+CXF+Design?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message