camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r844618 - in /websites/production/camel/content: cache/main.pageCache groovy-dsl.html twitter-websocket-example.html twitter.html
Date Wed, 02 Jan 2013 13:18:17 GMT
Author: buildbot
Date: Wed Jan  2 13:18:17 2013
New Revision: 844618

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/groovy-dsl.html
    websites/production/camel/content/twitter-websocket-example.html
    websites/production/camel/content/twitter.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/groovy-dsl.html
==============================================================================
--- websites/production/camel/content/groovy-dsl.html (original)
+++ websites/production/camel/content/groovy-dsl.html Wed Jan  2 13:18:17 2013
@@ -179,8 +179,116 @@ With the Groovy DSL you write your Route
 
 <h4><a shape="rect" name="GroovyDSL-UsingClosuresinyourroutes"></a>Using
Closures in your routes</h4>
 
+<h5><a shape="rect" name="GroovyDSL-ProcessorClosures"></a>Processor Closures</h5>
+
+<p>All Java DSL parameters of type <tt>org.apache.camel.Processor</tt>
can be replaced by a closure that accepts an object of type <tt>org.apache.camel.Exchange</tt>
as only parameter. The return value of the closure is disregarded. All closures may also refer
to variables not listed in their parameter list. Example:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+...
+   <span class="code-keyword">private</span> <span class="code-object">String</span>
someValue
+...
+   from('direct:test')
+      .process { Exchange exchange -&gt; println exchange.in.body + someValue }
+      .process { println it.in.body + someValue } <span class="code-comment">// equivalent
+</span>...
+</pre>
+</div></div>
+
+<h5><a shape="rect" name="GroovyDSL-ExpressionClosures"></a>Expression
Closures</h5>
+
+<p>All Java DSL parameters of type <tt>org.apache.camel.Expression</tt>
can be replaced by a closure that accepts an object of type <tt>org.apache.camel.Exchange</tt>
as only parameter. The return value of the closure is the result of the expression. Example:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+...
+   <span class="code-keyword">private</span> <span class="code-object">String</span>
someValue
+...
+   from('direct:test')
+      .transform { it.in.body.reverse() + someValue }
+      .setHeader(<span class="code-quote">"myHeader"</span>) { someValue.reverse()
}
+...
+</pre>
+</div></div>
+
+
+<h5><a shape="rect" name="GroovyDSL-PredicateClosures"></a>Predicate Closures</h5>
+
+<p>All Java DSL parameters of type <tt>org.apache.camel.Predicate</tt>
can be replaced by a closure that accepts an object of type <tt>org.apache.camel.Exchange</tt>
as only parameter. The return value of the closure is translated into a boolean value representing
the result of the predicate. Example:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+...
+   <span class="code-keyword">private</span> <span class="code-object">String</span>
someValue
+
+   <span class="code-comment">// This time, the closure is stored in a variable
+</span>   def predicate = { Exchange e -&gt; e.in.body != someValue }
+...
+   from('direct:test')
+      .filter(predicate)
+...
+</pre>
+</div></div>
+
+
+<h5><a shape="rect" name="GroovyDSL-AggregationStrategyClosures"></a>Aggregation
Strategy Closures</h5>
+
+<p>Java DSL parameters of type <tt>org.apache.camel.processor.aggregate.AggregationStrategy</tt>
can be replaced by a closure that accepts two objects of type <tt>org.apache.camel.Exchange</tt>
representing the two Exchanges to be aggregated. The return value of the closure must be the
aggregated Exchange. Example:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+...
+   <span class="code-keyword">private</span> <span class="code-object">String</span>
separator
+...
+   from('direct:test1')
+      .enrich('direct:enrich') { Exchange original, Exchange resource -&gt; 
+         original.in.body += resource.in.body + separator
+         original  <span class="code-comment">// don't forget to <span class="code-keyword">return</span>
resulting exchange
+</span>      }
+...
+</pre>
+</div></div>
+
+
 <h4><a shape="rect" name="GroovyDSL-UsingGroovyXMLprocessing"></a>Using
Groovy XML processing</h4>
 
+<p>Groovy provides special <a shape="rect" class="external-link" href="http://groovy.codehaus.org/Processing+XML"
rel="nofollow">XML processing support</a> through its <tt>XmlParser</tt>,
<tt>XmlNodePrinter</tt> and <tt>XmlSlurper</tt> classes. camel-groovy
provides two <a shape="rect" href="data-format.html" title="Data Format">data formats</a>
to use these classes directly in your routes. </p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Unmarshal XML with XmlParser</b></div><div
class="codeContent panelContent">
+<pre class="code-java">
+...
+   from('direct:test1')
+      .unmarshal().gnode() 
+      <span class="code-comment">// message body is now of type groovy.util.Node
+</span>...
+</pre>
+</div></div>
+
+<p>By default, XML processing is <em>namespace-aware</em>. You can change
this by providing a boolean <tt>false</tt> parameter.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Unmarshal XML with XmlSlurper</b></div><div
class="codeContent panelContent">
+<pre class="code-java">
+...
+   from('direct:test1')
+      .unmarshal().gpath(<span class="code-keyword">false</span>) <span class="code-comment">//
explicitly namespace-unaware
+</span>      <span class="code-comment">// message body is now of type groovy.util.slurpersupport.GPathResult
+</span>...
+</pre>
+</div></div>
+
+<p>Currently, marshalling is only supported for <tt>groovy.util.Node</tt>
objects.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Marshal XML with XmlNodePrinter</b></div><div
class="codeContent panelContent">
+<pre class="code-java">
+...
+   from('direct:test1')
+      <span class="code-comment">// message body must be of type groovy.util.Node
+</span>      .marshal().gnode()
+...
+</pre>
+</div></div>
+
+
 <h4><a shape="rect" name="GroovyDSL-UsingGroovyGStrings"></a>Using Groovy
GStrings</h4>
 
 <p>Groovy <a shape="rect" class="external-link" href="http://groovy.codehaus.org/Strings+and+GString"
rel="nofollow">GStrings</a> are declared inside double-quotes and can contain arbitrary
Groovy expressions like accessing properties or calling methods, e.g. </p>

Modified: websites/production/camel/content/twitter-websocket-example.html
==============================================================================
--- websites/production/camel/content/twitter-websocket-example.html (original)
+++ websites/production/camel/content/twitter-websocket-example.html Wed Jan  2 13:18:17 2013
@@ -123,7 +123,7 @@ mvn exec:java
 <p>Then open a browser to see live twitter updates in the webpage</p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
 <pre class="code-java">
-http:<span class="code-comment">//localhost:9090</span>
+http:<span class="code-comment">//localhost:9090/index.html</span>
 </pre>
 </div></div>
 

Modified: websites/production/camel/content/twitter.html
==============================================================================
--- websites/production/camel/content/twitter.html (original)
+++ websites/production/camel/content/twitter.html Wed Jan  2 13:18:17 2013
@@ -113,7 +113,7 @@ You can also configure these options dir
 <h3><a shape="rect" name="Twitter-ConsumerEndpoints%3A"></a>Consumer Endpoints:</h3>
 <p>Rather than the endpoints returning a List through one single route exchange, camel-twitter
creates one route exchange per returned object.  As an example, if "timeline/home" results
in five statuses, the route will be executed five times (one for each Status).</p>
 <div class="confluenceTableSmall"><div class="table-wrap">
-<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"> Endpoint </th><th colspan="1" rowspan="1" class="confluenceTh">
Context </th><th colspan="1" rowspan="1" class="confluenceTh"> Body Type </th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> directmessage </td><td colspan="1"
rowspan="1" class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.DirectMessage </td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"> search </td><td colspan="1" rowspan="1" class="confluenceTd">
direct, polling </td><td colspan="1" rowspan="1" class="confluenceTd"> twitter4j.Tweet
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> streaming/filter
</td><td colspan="1" rowspan="1" class="confluenceTd"> event, polling </td><td
colspan="1" rowspan="1" class="confluenceTd"> twitter4j.Status </td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> streaming/sample </td><td colspa
 n="1" rowspan="1" class="confluenceTd"> event, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.Status </td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"> timeline/home </td><td colspan="1" rowspan="1"
class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1" class="confluenceTd">
twitter4j.Status </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">
timeline/mentions </td><td colspan="1" rowspan="1" class="confluenceTd"> direct,
polling </td><td colspan="1" rowspan="1" class="confluenceTd"> twitter4j.Status
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> timeline/public
</td><td colspan="1" rowspan="1" class="confluenceTd"> direct, polling </td><td
colspan="1" rowspan="1" class="confluenceTd"> twitter4j.Status </td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> timeline/retweetsofme </td><td colspan="1"
rowspan="1" class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1"
cla
 ss="confluenceTd"> twitter4j.Status </td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"> timeline/user </td><td colspan="1" rowspan="1"
class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1" class="confluenceTd">
twitter4j.Status </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">
trends/daily </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Camel
2.10.1:</b> direct, polling </td><td colspan="1" rowspan="1" class="confluenceTd">
twitter4j.Status </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">
trends/weekly </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Camel
2.10.1:</b> direct, polling </td><td colspan="1" rowspan="1" class="confluenceTd">
twitter4j.Status </td></tr></tbody></table>
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"> Endpoint </th><th colspan="1" rowspan="1" class="confluenceTh">
Context </th><th colspan="1" rowspan="1" class="confluenceTh"> Body Type </th><th
colspan="1" rowspan="1" class="confluenceTh"> Notice </th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> directmessage </td><td colspan="1"
rowspan="1" class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.DirectMessage </td><td colspan="1" rowspan="1"
class="confluenceTd">&#160;</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"> search </td><td colspan="1" rowspan="1" class="confluenceTd">
direct, polling </td><td colspan="1" rowspan="1" class="confluenceTd"> twitter4j.Tweet
</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> streaming/filter </td><td colspan="1"
rowspan="1" class="confluenceTd"> e
 vent, polling </td><td colspan="1" rowspan="1" class="confluenceTd"> twitter4j.Status
</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> streaming/sample </td><td colspan="1"
rowspan="1" class="confluenceTd"> event, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.Status </td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> timeline/home </td><td colspan="1"
rowspan="1" class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.Status </td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> timeline/mentions </td><td colspan="1"
rowspan="1" class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.Status </td><td colspan="1" rowspan="1" class="confluenceTd">
 &#160;</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">
timeline/public </td><td colspan="1" rowspan="1" class="confluenceTd"> direct,
polling </td><td colspan="1" rowspan="1" class="confluenceTd"> twitter4j.Status
</td><td colspan="1" rowspan="1" class="confluenceTd"> @deprecated. Use timeline/home
or direct/home instead. Removed from <b>Camel 2.11</b> onwards. </td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> timeline/retweetsofme </td><td colspan="1"
rowspan="1" class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.Status </td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> timeline/user </td><td colspan="1"
rowspan="1" class="confluenceTd"> direct, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.Status </td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td></tr><tr><td
colspan="1" rowspan="1
 " class="confluenceTd"> trends/daily </td><td colspan="1" rowspan="1" class="confluenceTd">
<b>Camel 2.10.1:</b> direct, polling </td><td colspan="1" rowspan="1"
class="confluenceTd"> twitter4j.Status </td><td colspan="1" rowspan="1" class="confluenceTd">
@deprecated. Removed from Camel 2.11 onwards. </td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"> trends/weekly </td><td colspan="1" rowspan="1"
class="confluenceTd"> <b>Camel 2.10.1:</b> direct, polling </td><td
colspan="1" rowspan="1" class="confluenceTd"> twitter4j.Status </td><td colspan="1"
rowspan="1" class="confluenceTd"> @deprecated. Removed from Camel 2.11 onwards. </td></tr></tbody></table>
 </div>
 </div>
 



Mime
View raw message