You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Christian Schneider <ch...@die-schneider.net> on 2017/06/27 07:08:30 UTC

Prototype for reactive streams and a messaging component abstraction

I recently looked into ways to combine messaging and streaming on OSGi. 
So the following is a bit OSGi specific regarding finding components but 
I think this can also be done for non OSGi usage.

Interestingly the best reactive streams solution I found for my case was 
Reactor (by Pivotal) which is the core of spring 5. It works out of the 
box on OSGi and only has a single dependency.
The next thing was how to combine this with messaging in a loosely 
coupled way. I really like Apache Camel but I think it is not up to date 
any more and also acquired a lot of weight over time (especially in 
camel-core). So I was looking into providing a light weight component 
API and combine it with Reactor.

The result is this project:

https://github.com/cschneider/streaming-osgi/tree/master/reactortest

This is the Component API: 
https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/component/api/MComponent.java 

Actually I am unsure if the converter must be part of the API but this 
is the current state.

I created some POC components for Mqtt, EventAdmin and Mail.

and finally two examples:
Listen on eventadmin topic, log and forward to other topic:
https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/reactortest/ExampleEventAdmin.java 


Listen to mqtt, compute average over sliding window and forward to other 
topic:
https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/reactortest/MqttExampleComponent.java 


I think there is a lot of potential in Reactor and also in messaging 
components that do not couple your code to the technology.
I would be happy about any feedback on the prototype. Beware the code is 
not yet split into bundles but I hope the intention is still visible.

Best

Christian

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Prototype for reactive streams and a messaging component abstraction

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Claus,

I have now looked into the camel reactive support in detail. It looks 
great and I think it could be very well combined with what I have in 
mind with "reactive components".

The idea behind reactive components is to have a very simple API for 
components that is completely independent from (current) camel. Of 
course in itself it would be of limited use as the reactive DSLs are not 
yet en par with camel. The camel reactive support might be the ideal 
bridge. It would allow to use any reactive component in camel as well as 
have a camel reactive component that receives or sends via existing 
camel components.

For now I will host reactive components as a karaf subproject as there 
was more support for it there but I think if it works out it might be 
better hosted at camel in the future. I really think we need a fresh 
start for components without the legacy of camel-core for mid to long term.

Best

Christian

On 27.06.2017 09:47, Claus Ibsen wrote:
> Hi
>
> Yeah there is already reactive stuff today in Apache Camel as well some examples
> https://github.com/apache/camel/tree/master/examples
>
> The reactive streams is the abstraction API where you can then chose
> to use RxJava 2 or Reactor. There is a camel-rx2 in the works for
> Camel 2.20. The old camel-rx is for RxJava 1.x and will be deprecated.
>
> There is also a full chapter about Reactive Camel in the CiA2 book,
> which will be freely available for online download later, as its been
> decided to be a bonus chapter.
>
> The source code for the book has some smaller examples as well
> https://github.com/camelinaction/camelinaction2/tree/master/chapter21/reactive-streams
>
> And hopefully Nicola's talk will be posted on youtube as it was
> recorded, and it showcased how great Camel already works with Reactive
> today.
>
>
> On Tue, Jun 27, 2017 at 9:40 AM, Zoran Regvart <zo...@regvart.com> wrote:
>> Hi Christian,
>> that's really cool, the Reactor projects brings about a nice API and a
>> lot of functionality out of the box. I think the main thing with Camel
>> being fully reactive is to find out how to do that with all the EIPs
>> supported.
>>
>> I think you might find it interesting that Nicola created a way to
>> integrate reactive systems with Camel with camel-reactive-streams[1],
>> you can find out more in the talk he did recently[2].
>>
>> zoran
>>
>> [1] https://github.com/apache/camel/blob/master/components/camel-reactive-streams/src/main/docs/reactive-streams-component.adoc
>> [2] https://www.nicolaferraro.me/2017/06/20/jbcnconf-barcelona-integrating-applications-the-reactive-way/
>>
>> On Tue, Jun 27, 2017 at 9:08 AM, Christian Schneider
>> <ch...@die-schneider.net> wrote:
>>> I recently looked into ways to combine messaging and streaming on OSGi. So
>>> the following is a bit OSGi specific regarding finding components but I
>>> think this can also be done for non OSGi usage.
>>>
>>> Interestingly the best reactive streams solution I found for my case was
>>> Reactor (by Pivotal) which is the core of spring 5. It works out of the box
>>> on OSGi and only has a single dependency.
>>> The next thing was how to combine this with messaging in a loosely coupled
>>> way. I really like Apache Camel but I think it is not up to date any more
>>> and also acquired a lot of weight over time (especially in camel-core). So I
>>> was looking into providing a light weight component API and combine it with
>>> Reactor.
>>>
>>> The result is this project:
>>>
>>> https://github.com/cschneider/streaming-osgi/tree/master/reactortest
>>>
>>> This is the Component API:
>>> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/component/api/MComponent.java
>>> Actually I am unsure if the converter must be part of the API but this is
>>> the current state.
>>>
>>> I created some POC components for Mqtt, EventAdmin and Mail.
>>>
>>> and finally two examples:
>>> Listen on eventadmin topic, log and forward to other topic:
>>> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/reactortest/ExampleEventAdmin.java
>>>
>>> Listen to mqtt, compute average over sliding window and forward to other
>>> topic:
>>> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/reactortest/MqttExampleComponent.java
>>>
>>> I think there is a lot of potential in Reactor and also in messaging
>>> components that do not couple your code to the technology.
>>> I would be happy about any feedback on the prototype. Beware the code is not
>>> yet split into bundles but I hope the intention is still visible.
>>>
>>> Best
>>>
>>> Christian
>>>
>>> --
>>> Christian Schneider
>>> http://www.liquid-reality.de
>>>
>>> Open Source Architect
>>> http://www.talend.com
>>>
>>
>>
>> --
>> Zoran Regvart
>
>

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Prototype for reactive streams and a messaging component abstraction

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah there is already reactive stuff today in Apache Camel as well some examples
https://github.com/apache/camel/tree/master/examples

The reactive streams is the abstraction API where you can then chose
to use RxJava 2 or Reactor. There is a camel-rx2 in the works for
Camel 2.20. The old camel-rx is for RxJava 1.x and will be deprecated.

There is also a full chapter about Reactive Camel in the CiA2 book,
which will be freely available for online download later, as its been
decided to be a bonus chapter.

The source code for the book has some smaller examples as well
https://github.com/camelinaction/camelinaction2/tree/master/chapter21/reactive-streams

And hopefully Nicola's talk will be posted on youtube as it was
recorded, and it showcased how great Camel already works with Reactive
today.


On Tue, Jun 27, 2017 at 9:40 AM, Zoran Regvart <zo...@regvart.com> wrote:
> Hi Christian,
> that's really cool, the Reactor projects brings about a nice API and a
> lot of functionality out of the box. I think the main thing with Camel
> being fully reactive is to find out how to do that with all the EIPs
> supported.
>
> I think you might find it interesting that Nicola created a way to
> integrate reactive systems with Camel with camel-reactive-streams[1],
> you can find out more in the talk he did recently[2].
>
> zoran
>
> [1] https://github.com/apache/camel/blob/master/components/camel-reactive-streams/src/main/docs/reactive-streams-component.adoc
> [2] https://www.nicolaferraro.me/2017/06/20/jbcnconf-barcelona-integrating-applications-the-reactive-way/
>
> On Tue, Jun 27, 2017 at 9:08 AM, Christian Schneider
> <ch...@die-schneider.net> wrote:
>> I recently looked into ways to combine messaging and streaming on OSGi. So
>> the following is a bit OSGi specific regarding finding components but I
>> think this can also be done for non OSGi usage.
>>
>> Interestingly the best reactive streams solution I found for my case was
>> Reactor (by Pivotal) which is the core of spring 5. It works out of the box
>> on OSGi and only has a single dependency.
>> The next thing was how to combine this with messaging in a loosely coupled
>> way. I really like Apache Camel but I think it is not up to date any more
>> and also acquired a lot of weight over time (especially in camel-core). So I
>> was looking into providing a light weight component API and combine it with
>> Reactor.
>>
>> The result is this project:
>>
>> https://github.com/cschneider/streaming-osgi/tree/master/reactortest
>>
>> This is the Component API:
>> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/component/api/MComponent.java
>> Actually I am unsure if the converter must be part of the API but this is
>> the current state.
>>
>> I created some POC components for Mqtt, EventAdmin and Mail.
>>
>> and finally two examples:
>> Listen on eventadmin topic, log and forward to other topic:
>> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/reactortest/ExampleEventAdmin.java
>>
>> Listen to mqtt, compute average over sliding window and forward to other
>> topic:
>> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/reactortest/MqttExampleComponent.java
>>
>> I think there is a lot of potential in Reactor and also in messaging
>> components that do not couple your code to the technology.
>> I would be happy about any feedback on the prototype. Beware the code is not
>> yet split into bundles but I hope the intention is still visible.
>>
>> Best
>>
>> Christian
>>
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Open Source Architect
>> http://www.talend.com
>>
>
>
>
> --
> Zoran Regvart



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Prototype for reactive streams and a messaging component abstraction

Posted by Zoran Regvart <zo...@regvart.com>.
Hi Christian,
that's really cool, the Reactor projects brings about a nice API and a
lot of functionality out of the box. I think the main thing with Camel
being fully reactive is to find out how to do that with all the EIPs
supported.

I think you might find it interesting that Nicola created a way to
integrate reactive systems with Camel with camel-reactive-streams[1],
you can find out more in the talk he did recently[2].

zoran

[1] https://github.com/apache/camel/blob/master/components/camel-reactive-streams/src/main/docs/reactive-streams-component.adoc
[2] https://www.nicolaferraro.me/2017/06/20/jbcnconf-barcelona-integrating-applications-the-reactive-way/

On Tue, Jun 27, 2017 at 9:08 AM, Christian Schneider
<ch...@die-schneider.net> wrote:
> I recently looked into ways to combine messaging and streaming on OSGi. So
> the following is a bit OSGi specific regarding finding components but I
> think this can also be done for non OSGi usage.
>
> Interestingly the best reactive streams solution I found for my case was
> Reactor (by Pivotal) which is the core of spring 5. It works out of the box
> on OSGi and only has a single dependency.
> The next thing was how to combine this with messaging in a loosely coupled
> way. I really like Apache Camel but I think it is not up to date any more
> and also acquired a lot of weight over time (especially in camel-core). So I
> was looking into providing a light weight component API and combine it with
> Reactor.
>
> The result is this project:
>
> https://github.com/cschneider/streaming-osgi/tree/master/reactortest
>
> This is the Component API:
> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/component/api/MComponent.java
> Actually I am unsure if the converter must be part of the API but this is
> the current state.
>
> I created some POC components for Mqtt, EventAdmin and Mail.
>
> and finally two examples:
> Listen on eventadmin topic, log and forward to other topic:
> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/reactortest/ExampleEventAdmin.java
>
> Listen to mqtt, compute average over sliding window and forward to other
> topic:
> https://github.com/cschneider/streaming-osgi/blob/master/reactortest/src/main/java/reactortest/MqttExampleComponent.java
>
> I think there is a lot of potential in Reactor and also in messaging
> components that do not couple your code to the technology.
> I would be happy about any feedback on the prototype. Beware the code is not
> yet split into bundles but I hope the intention is still visible.
>
> Best
>
> Christian
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>



-- 
Zoran Regvart