Author: buildbot Date: Mon Mar 4 09:18:34 2013 New Revision: 852899 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/rx.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/rx.html ============================================================================== --- websites/production/camel/content/rx.html (original) +++ websites/production/camel/content/rx.html Mon Mar 4 09:18:34 2013 @@ -77,13 +77,27 @@ <td valign="top" width="100%"> <div class="wiki-content maincontent"><h1><a shape="rect" name="RX-CamelRX"></a>Camel RX</h1> -<p>The camel-rx library provides Camel support for the <a shape="rect" class="external-link" href="https://rx.codeplex.com/" rel="nofollow">Reactive Extensions</a> (RX) using the <a shape="rect" class="external-link" href="https://github.com/Netflix/RxJava/wiki" rel="nofollow">RxJava</a> library.</p> +<p>The camel-rx library provides Camel support for the <a shape="rect" class="external-link" href="https://rx.codeplex.com/" rel="nofollow">Reactive Extensions</a> (RX) using the <a shape="rect" class="external-link" href="https://github.com/Netflix/RxJava/wiki" rel="nofollow">RxJava</a> library so that:</p> -<p>You can think of RX as providing an API similar to Java 8 / Groovy / Scala like API collections (methods like filter, forEach, map, flatMap etc) - but which operates on a stream of events rather than a collection. So you could think of RX as like working with asynchronous push based collections (rather than the traditional synchronous pull based collections).</p> +<ul><li>Camel users can use the <a shape="rect" class="external-link" href="http://netflix.github.com/RxJava/javadoc/" rel="nofollow">RxJava API</a> for processing messages on endpoints using a typesafe composable API</li><li><a shape="rect" class="external-link" href="https://github.com/Netflix/RxJava/wiki" rel="nofollow">RxJava</a> users get to use all of the <a shape="rect" href="components.html" title="Components">Camel transports and protocols</a> from within the <a shape="rect" class="external-link" href="http://netflix.github.com/RxJava/javadoc/" rel="nofollow">RxJava API</a></li></ul> -<p>In RX, if you have an <a shape="rect" class="external-link" href="http://netflix.github.com/RxJava/javadoc/rx/Observable.html" rel="nofollow">Observable<T></a> which behaves quite like a Collection<T> in Java 8 so you can filter/map/concat and so forth. The Observable<T> then acts as a typesafe composable API for working with asynchronous events.</p> -<p>You can then create an Observable<Message> from any endpoint using the ReactiveCamel helper class.</p> +<h2><a shape="rect" name="RX-BackgroundonRX"></a>Background on RX</h2> + +<p>For a more in depth background on RX check out <a shape="rect" class="external-link" href="https://github.com/Netflix/RxJava/wiki/Observable" rel="nofollow">the RxJava wiki on Observable and the Reactive pattern</a> or the <a shape="rect" class="external-link" href="https://rx.codeplex.com/" rel="nofollow">Microsoft RX documentation</a>.</p> + +<p>You can think of RX as providing an API similar to Java 8 / Groovy / Scala collections (methods like filter, map, zip etc) - but which operates on an asynchronous stream of events rather than a collection. So you could think of RX as like working with asynchronous push based collections (rather than the traditional synchronous pull based collections).</p> + +<p>In RX you work with an <a shape="rect" class="external-link" href="http://netflix.github.com/RxJava/javadoc/rx/Observable.html" rel="nofollow">Observable<T></a> which behaves quite like a Collection<T> in Java 8 so you can filter/map/concat and so forth. The Observable<T> then acts as a typesafe composable API for working with asynchronous events in a collection-like way.</p> + +<p>Once you have an <a shape="rect" class="external-link" href="http://netflix.github.com/RxJava/javadoc/rx/Observable.html" rel="nofollow">Observable<T></a> you can then </p> + +<ul><li><a shape="rect" class="external-link" href="https://github.com/Netflix/RxJava/wiki/Filtering-Operators" rel="nofollow">filter events</a></li><li><a shape="rect" class="external-link" href="https://github.com/Netflix/RxJava/wiki/Transformative-Operators" rel="nofollow">transform events</a></li><li><a shape="rect" class="external-link" href="https://github.com/Netflix/RxJava/wiki/Combinatorial-Operators" rel="nofollow">combine event streams</a></li><li><a shape="rect" class="external-link" href="https://github.com/Netflix/RxJava/wiki/Utility-Operators" rel="nofollow">other utility methods</a></li></ul> + + +<h2><a shape="rect" name="RX-ObservingeventsonCamelendpoints"></a>Observing events on Camel endpoints </h2> + +<p>You can create an Observable<Message> from any endpoint using the ReactiveCamel helper class and the <b>toObservable()</b> method.</p> <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> <pre class="code-java"> @@ -116,7 +130,24 @@ Observable<Order> observable = rx. } }); </pre> -</div></div></div> +</div></div> + +<h2><a shape="rect" name="RX-SendingObservable%3CT%3EeventstoCamelendpoints"></a>Sending Observable<T> events to Camel endpoints</h2> + +<p>If you have an <a shape="rect" class="external-link" href="http://netflix.github.com/RxJava/javadoc/rx/Observable.html" rel="nofollow">Observable<T></a> from some other library; or have created one from a <a shape="rect" class="external-link" href="http://netflix.github.com/RxJava/javadoc/rx/Observable.html#toObservable(java.util.concurrent.Future)" rel="nofollow">Future<T> using RxJava</a> and you wish to send the events on the observable to a Camel endpoint you can use the <b>sendTo()</b> method on ReactiveCamel:</p> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<pre class="code-java"> +<span class="code-keyword">import</span> org.apache.camel.rx.*; + +<span class="code-comment">// take some observable from somewhere +</span>Observable<T> observable = ...; +ReactiveCamel rx = <span class="code-keyword">new</span> ReactiveCamel(camelContext); + +<span class="code-comment">// lets send the events to a message queue +</span>rx.sendTo(observable, <span class="code-quote">"activemq:MyQueue"</span>); +</pre> +</div></div> </div> </td> <td valign="top"> <div class="navigation">