You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/04/01 17:44:53 UTC
[jira] [Commented] (CAMEL-7833) create an extension of the RX
Observable to add more of the Camel DSL in there (e.g. to() or to go
back to the general camel DSL)
[ https://issues.apache.org/jira/browse/CAMEL-7833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14390843#comment-14390843 ]
ASF GitHub Bot commented on CAMEL-7833:
---------------------------------------
GitHub user yuruki opened a pull request:
https://github.com/apache/camel/pull/459
CAMEL-7833 Use Camel endpoints inside RX sequence
CamelOperator class allows us to use Camel endpoints inside an RX sequence, like so:
```
Observable<Message> in = reactiveCamel.toObservable("direct:start")
.lift(new CamelOperator(camelContext, "xslt:something.xsl"))
.lift(new CamelOperator(anotherEndpoint));
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/yuruki/camel camel-rx
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/459.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #459
----
commit 414e968fb26cfb5f707f2e7024ff423dcdac9af9
Author: Jyrki Ruuskanen <yu...@kotikone.fi>
Date: 2015-04-01T14:54:26Z
Added CamelOperator for lift()
commit 5384bc26859c1af73610ce3d74a3f014620a19b7
Author: Jyrki Ruuskanen <yu...@kotikone.fi>
Date: 2015-04-01T15:34:47Z
Added CamelOperatorTest
----
> create an extension of the RX Observable<T> to add more of the Camel DSL in there (e.g. to() or to go back to the general camel DSL)
> ------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-7833
> URL: https://issues.apache.org/jira/browse/CAMEL-7833
> Project: Camel
> Issue Type: New Feature
> Reporter: james strachan
>
> with Camel RX and java 8 we can do some nice lambdas and typesafe filtering and transformation:
> {code}
> ReactiveCamel rx = new ReactiveCamel(camelContext);
> Observable<Order> observable = rx.toObservable("seda:orders", Order.class);
>
> // now lets filter and map using Java 8
> Observable<String> largeOrderIds = observable.
> filter(order -> order.getAmount() > 100.0).
> map(order -> order.getId());
>
> rx.sendTo(observable, "activemq:MyQueue");
> {code}
> however the DSL isn't quite as nice as Camel's due to the lack of the camel verbs like "to()". It'd be nice to provide an extended Observable<T> interface which adds more of Camel's DSL in there too; so you can still use things the RX way; but can also reuse the camel DSL too (in a typesafe way).
> e.g. something like this
> {code}
> // Observable comes from RX; it'd be nice to have a camel extended version so we can add camel DSL stuff in there like to() etc....
> CamelStream<Order> orders = rx.stream("seda:orders", Order.class);
>
> // now lets filter and map using Java 8
> orders.
> filter(order -> order.getAmount() > 100.0).
> map(order -> order.getId()).
> to("activemq:MyQueue");
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)