You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Stiborský <ma...@gmail.com> on 2012/11/02 15:49:08 UTC

Split, transform and aggregate RSS XML feed

Hello,
currently I'm working on a case, where is RSS XML feed as data source,
which I need to grab and parse/transform in to POJO classes structure and
the return back as JSON.

Concerning the relevant route in Camel, I have restlet as the consumer
endpoint (there are few things needed to declare in the GET request to
fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
the RSS XML feed and then should follow some transformation strategy to
POJO classes and then send  response back to browser/user (producer
endpoint).

The structure of the RSS XML feed is nothing tricky, it has simple
structure, simply there is a tag I know, which should be used to split by,
to get each chunk of the feed.

So, I tried tokenizeXML() to split the feed. Good, it works. Then, I tried
custom Aggregation Strategy, to get all pieces back together. Works as well.
But, where in this scenario fit the transformation part? Right in the
Aggregation Strategy? Why not, it works as well for me. But I'm not sure,
if all that is correct.

There should be separated transformation step in the route, what you say?

Thanks for hints, guys!

-- 
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz

RE: Split, transform and aggregate RSS XML feed

Posted by Ra...@cognizant.com.
Thanks. Yeah for his use case it will reinventing wheel to use ROME.

-----Original Message-----
From: Raul Kripalani [mailto:raul@evosent.com]
Sent: Saturday, November 03, 2012 11:38 PM
To: users@camel.apache.org
Subject: Re: Split, transform and aggregate RSS XML feed

Hi Martin!

Indeed, this last explanation completely changes your use case ;)

If all you need is to transform the RSS XML into JSON, have you looked at
the camel-xmljson data format [1]? Something like that will do:

from("rss:feedUrl?consumer.delay=30000")
   .marshal().rss()           // convert from Rome's model to XML
   .marshal().xmljson()    // convert from XML to JSON
   .to("log:test");             // output the result to the log

I strongly suggest using Camel instead of reinventing the wheel like
Ramkumar suggested below by creating the entire pipeline from scratch ;)

[1] http://camel.apache.org/xmljson.html

 Regards,

*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk <http://twitter.com/raulvk>

On Sat, Nov 3, 2012 at 11:37 AM, Martin Stiborský <
martin.stiborsky@gmail.com> wrote:

> Hello,
> I guess my crappy english took it place, because I think enricher is not
> the thing I need.
>
> What I need, is a RSS feed on input and the same RSS on output, but in JSON
> format. I don't need to add there any other content, any other RSS, just
> the transformation/converting to JSON.
>
> The solution I have and I described here, is not ideal I guess. I was
> thinking that split the RSS feed is a good idea, once it's splitted I can
> parse one chunk per time, convert them into POJO classes which holds the
> one feed chunk data and at the end, go through the List of POJO classes on
> send them  back to browser in JSON.
>
> Maybe, I could skipp the splitting and process the whole RSS XML feed,
> maybe with XSLT, I don't know and I don't like XSLT :)
>
> I have to figure it out somehow.
>
>
> On Fri, Nov 2, 2012 at 4:59 PM, <Ra...@cognizant.com> wrote:
>
> > I am not sure if I understand you rightly but have you looked at content
> > enricher EIP. Basically you have RSS feeds that are enriched through a
> > split-aggregate. Example merge RSS feeds for "USA" across multiple
> articles
> > creating one RSS feed for "USA" etc.
> >
> > http://camel.apache.org/content-enricher.html
> > The content enricher (enrich) retrieves additional data from a resource
> > endpoint in order to enrich an incoming message (contained in the
> original
> > exchange). An aggregation strategy is used to combine the original
> exchange
> > and the resource exchange.
> > -----Original Message-----
> > From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
> > Sent: Friday, November 02, 2012 8:19 PM
> > To: users@camel.apache.org
> > Subject: Split, transform and aggregate RSS XML feed
> >
> > Hello,
> > currently I'm working on a case, where is RSS XML feed as data source,
> > which I need to grab and parse/transform in to POJO classes structure and
> > the return back as JSON.
> >
> > Concerning the relevant route in Camel, I have restlet as the consumer
> > endpoint (there are few things needed to declare in the GET request to
> > fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
> > the RSS XML feed and then should follow some transformation strategy to
> > POJO classes and then send  response back to browser/user (producer
> > endpoint).
> >
> > The structure of the RSS XML feed is nothing tricky, it has simple
> > structure, simply there is a tag I know, which should be used to split
> by,
> > to get each chunk of the feed.
> >
> > So, I tried tokenizeXML() to split the feed. Good, it works. Then, I
> tried
> > custom Aggregation Strategy, to get all pieces back together. Works as
> > well.
> > But, where in this scenario fit the transformation part? Right in the
> > Aggregation Strategy? Why not, it works as well for me. But I'm not sure,
> > if all that is correct.
> >
> > There should be separated transformation step in the route, what you say?
> >
> > Thanks for hints, guys!
> >
> > --
> > S pozdravem
> > Martin Stiborský
> >
> > Jabber: stibi@njs.netlab.cz
> > This e-mail and any files transmitted with it are for the sole use of the
> > intended recipient(s) and may contain confidential and privileged
> > information. If you are not the intended recipient(s), please reply to
> the
> > sender and destroy all copies of the original message. Any unauthorized
> > review, use, disclosure, dissemination, forwarding, printing or copying
> of
> > this email, and/or any action taken in reliance on the contents of this
> > e-mail is strictly prohibited and may be unlawful.
> >
>
>
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
>
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.

Re: Split, transform and aggregate RSS XML feed

Posted by Raul Kripalani <ra...@evosent.com>.
Hi Martin!

Indeed, this last explanation completely changes your use case ;)

If all you need is to transform the RSS XML into JSON, have you looked at
the camel-xmljson data format [1]? Something like that will do:

from("rss:feedUrl?consumer.delay=30000")
   .marshal().rss()           // convert from Rome's model to XML
   .marshal().xmljson()    // convert from XML to JSON
   .to("log:test");             // output the result to the log

I strongly suggest using Camel instead of reinventing the wheel like
Ramkumar suggested below by creating the entire pipeline from scratch ;)

[1] http://camel.apache.org/xmljson.html

 Regards,

*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk <http://twitter.com/raulvk>

On Sat, Nov 3, 2012 at 11:37 AM, Martin Stiborský <
martin.stiborsky@gmail.com> wrote:

> Hello,
> I guess my crappy english took it place, because I think enricher is not
> the thing I need.
>
> What I need, is a RSS feed on input and the same RSS on output, but in JSON
> format. I don't need to add there any other content, any other RSS, just
> the transformation/converting to JSON.
>
> The solution I have and I described here, is not ideal I guess. I was
> thinking that split the RSS feed is a good idea, once it's splitted I can
> parse one chunk per time, convert them into POJO classes which holds the
> one feed chunk data and at the end, go through the List of POJO classes on
> send them  back to browser in JSON.
>
> Maybe, I could skipp the splitting and process the whole RSS XML feed,
> maybe with XSLT, I don't know and I don't like XSLT :)
>
> I have to figure it out somehow.
>
>
> On Fri, Nov 2, 2012 at 4:59 PM, <Ra...@cognizant.com> wrote:
>
> > I am not sure if I understand you rightly but have you looked at content
> > enricher EIP. Basically you have RSS feeds that are enriched through a
> > split-aggregate. Example merge RSS feeds for "USA" across multiple
> articles
> > creating one RSS feed for "USA" etc.
> >
> > http://camel.apache.org/content-enricher.html
> > The content enricher (enrich) retrieves additional data from a resource
> > endpoint in order to enrich an incoming message (contained in the
> original
> > exchange). An aggregation strategy is used to combine the original
> exchange
> > and the resource exchange.
> > -----Original Message-----
> > From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
> > Sent: Friday, November 02, 2012 8:19 PM
> > To: users@camel.apache.org
> > Subject: Split, transform and aggregate RSS XML feed
> >
> > Hello,
> > currently I'm working on a case, where is RSS XML feed as data source,
> > which I need to grab and parse/transform in to POJO classes structure and
> > the return back as JSON.
> >
> > Concerning the relevant route in Camel, I have restlet as the consumer
> > endpoint (there are few things needed to declare in the GET request to
> > fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
> > the RSS XML feed and then should follow some transformation strategy to
> > POJO classes and then send  response back to browser/user (producer
> > endpoint).
> >
> > The structure of the RSS XML feed is nothing tricky, it has simple
> > structure, simply there is a tag I know, which should be used to split
> by,
> > to get each chunk of the feed.
> >
> > So, I tried tokenizeXML() to split the feed. Good, it works. Then, I
> tried
> > custom Aggregation Strategy, to get all pieces back together. Works as
> > well.
> > But, where in this scenario fit the transformation part? Right in the
> > Aggregation Strategy? Why not, it works as well for me. But I'm not sure,
> > if all that is correct.
> >
> > There should be separated transformation step in the route, what you say?
> >
> > Thanks for hints, guys!
> >
> > --
> > S pozdravem
> > Martin Stiborský
> >
> > Jabber: stibi@njs.netlab.cz
> > This e-mail and any files transmitted with it are for the sole use of the
> > intended recipient(s) and may contain confidential and privileged
> > information. If you are not the intended recipient(s), please reply to
> the
> > sender and destroy all copies of the original message. Any unauthorized
> > review, use, disclosure, dissemination, forwarding, printing or copying
> of
> > this email, and/or any action taken in reliance on the contents of this
> > e-mail is strictly prohibited and may be unlawful.
> >
>
>
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
>

Re: Split, transform and aggregate RSS XML feed

Posted by Martin Stiborský <ma...@gmail.com>.
Hi Claus,

thanks for hints, I'll use it.
I really appreciate your effort in helping community around Apache Camel
and others, it's inspiring.


On Sat, Nov 3, 2012 at 12:45 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Sounds a bit like the Composed Message Processor EIP
> http://camel.apache.org/composed-message-processor.html
>
> And as you have figured out the splitter has built-in aggregator.
>
> Each splitted message you can transform from RSS -> POJO -> JSON
> (either in one or two steps)
> And then in the aggregation strategy "merge" the pieces together.
>
> Or you can possible do the List<POJO> to JSON after the composed
> message processor eip using a data format that can format a List<POJO>
> to a List JSON format.
>
> Using XSLT I would stay away from. That is often hard to get right and
> for other people to maintain.
>
>
>
> On Sat, Nov 3, 2012 at 12:37 PM, Martin Stiborský
> <ma...@gmail.com> wrote:
> > Hello,
> > I guess my crappy english took it place, because I think enricher is not
> > the thing I need.
> >
> > What I need, is a RSS feed on input and the same RSS on output, but in
> JSON
> > format. I don't need to add there any other content, any other RSS, just
> > the transformation/converting to JSON.
> >
> > The solution I have and I described here, is not ideal I guess. I was
> > thinking that split the RSS feed is a good idea, once it's splitted I can
> > parse one chunk per time, convert them into POJO classes which holds the
> > one feed chunk data and at the end, go through the List of POJO classes
> on
> > send them  back to browser in JSON.
> >
> > Maybe, I could skipp the splitting and process the whole RSS XML feed,
> > maybe with XSLT, I don't know and I don't like XSLT :)
> >
> > I have to figure it out somehow.
> >
> >
> > On Fri, Nov 2, 2012 at 4:59 PM, <Ra...@cognizant.com> wrote:
> >
> >> I am not sure if I understand you rightly but have you looked at content
> >> enricher EIP. Basically you have RSS feeds that are enriched through a
> >> split-aggregate. Example merge RSS feeds for "USA" across multiple
> articles
> >> creating one RSS feed for "USA" etc.
> >>
> >> http://camel.apache.org/content-enricher.html
> >> The content enricher (enrich) retrieves additional data from a resource
> >> endpoint in order to enrich an incoming message (contained in the
> original
> >> exchange). An aggregation strategy is used to combine the original
> exchange
> >> and the resource exchange.
> >> -----Original Message-----
> >> From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
> >> Sent: Friday, November 02, 2012 8:19 PM
> >> To: users@camel.apache.org
> >> Subject: Split, transform and aggregate RSS XML feed
> >>
> >> Hello,
> >> currently I'm working on a case, where is RSS XML feed as data source,
> >> which I need to grab and parse/transform in to POJO classes structure
> and
> >> the return back as JSON.
> >>
> >> Concerning the relevant route in Camel, I have restlet as the consumer
> >> endpoint (there are few things needed to declare in the GET request to
> >> fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
> >> the RSS XML feed and then should follow some transformation strategy to
> >> POJO classes and then send  response back to browser/user (producer
> >> endpoint).
> >>
> >> The structure of the RSS XML feed is nothing tricky, it has simple
> >> structure, simply there is a tag I know, which should be used to split
> by,
> >> to get each chunk of the feed.
> >>
> >> So, I tried tokenizeXML() to split the feed. Good, it works. Then, I
> tried
> >> custom Aggregation Strategy, to get all pieces back together. Works as
> >> well.
> >> But, where in this scenario fit the transformation part? Right in the
> >> Aggregation Strategy? Why not, it works as well for me. But I'm not
> sure,
> >> if all that is correct.
> >>
> >> There should be separated transformation step in the route, what you
> say?
> >>
> >> Thanks for hints, guys!
> >>
> >> --
> >> S pozdravem
> >> Martin Stiborský
> >>
> >> Jabber: stibi@njs.netlab.cz
> >> This e-mail and any files transmitted with it are for the sole use of
> the
> >> intended recipient(s) and may contain confidential and privileged
> >> information. If you are not the intended recipient(s), please reply to
> the
> >> sender and destroy all copies of the original message. Any unauthorized
> >> review, use, disclosure, dissemination, forwarding, printing or copying
> of
> >> this email, and/or any action taken in reliance on the contents of this
> >> e-mail is strictly prohibited and may be unlawful.
> >>
> >
> >
> >
> > --
> > S pozdravem
> > Martin Stiborský
> >
> > Jabber: stibi@njs.netlab.cz
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz

Re: Split, transform and aggregate RSS XML feed

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

Sounds a bit like the Composed Message Processor EIP
http://camel.apache.org/composed-message-processor.html

And as you have figured out the splitter has built-in aggregator.

Each splitted message you can transform from RSS -> POJO -> JSON
(either in one or two steps)
And then in the aggregation strategy "merge" the pieces together.

Or you can possible do the List<POJO> to JSON after the composed
message processor eip using a data format that can format a List<POJO>
to a List JSON format.

Using XSLT I would stay away from. That is often hard to get right and
for other people to maintain.



On Sat, Nov 3, 2012 at 12:37 PM, Martin Stiborský
<ma...@gmail.com> wrote:
> Hello,
> I guess my crappy english took it place, because I think enricher is not
> the thing I need.
>
> What I need, is a RSS feed on input and the same RSS on output, but in JSON
> format. I don't need to add there any other content, any other RSS, just
> the transformation/converting to JSON.
>
> The solution I have and I described here, is not ideal I guess. I was
> thinking that split the RSS feed is a good idea, once it's splitted I can
> parse one chunk per time, convert them into POJO classes which holds the
> one feed chunk data and at the end, go through the List of POJO classes on
> send them  back to browser in JSON.
>
> Maybe, I could skipp the splitting and process the whole RSS XML feed,
> maybe with XSLT, I don't know and I don't like XSLT :)
>
> I have to figure it out somehow.
>
>
> On Fri, Nov 2, 2012 at 4:59 PM, <Ra...@cognizant.com> wrote:
>
>> I am not sure if I understand you rightly but have you looked at content
>> enricher EIP. Basically you have RSS feeds that are enriched through a
>> split-aggregate. Example merge RSS feeds for "USA" across multiple articles
>> creating one RSS feed for "USA" etc.
>>
>> http://camel.apache.org/content-enricher.html
>> The content enricher (enrich) retrieves additional data from a resource
>> endpoint in order to enrich an incoming message (contained in the original
>> exchange). An aggregation strategy is used to combine the original exchange
>> and the resource exchange.
>> -----Original Message-----
>> From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
>> Sent: Friday, November 02, 2012 8:19 PM
>> To: users@camel.apache.org
>> Subject: Split, transform and aggregate RSS XML feed
>>
>> Hello,
>> currently I'm working on a case, where is RSS XML feed as data source,
>> which I need to grab and parse/transform in to POJO classes structure and
>> the return back as JSON.
>>
>> Concerning the relevant route in Camel, I have restlet as the consumer
>> endpoint (there are few things needed to declare in the GET request to
>> fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
>> the RSS XML feed and then should follow some transformation strategy to
>> POJO classes and then send  response back to browser/user (producer
>> endpoint).
>>
>> The structure of the RSS XML feed is nothing tricky, it has simple
>> structure, simply there is a tag I know, which should be used to split by,
>> to get each chunk of the feed.
>>
>> So, I tried tokenizeXML() to split the feed. Good, it works. Then, I tried
>> custom Aggregation Strategy, to get all pieces back together. Works as
>> well.
>> But, where in this scenario fit the transformation part? Right in the
>> Aggregation Strategy? Why not, it works as well for me. But I'm not sure,
>> if all that is correct.
>>
>> There should be separated transformation step in the route, what you say?
>>
>> Thanks for hints, guys!
>>
>> --
>> S pozdravem
>> Martin Stiborský
>>
>> Jabber: stibi@njs.netlab.cz
>> This e-mail and any files transmitted with it are for the sole use of the
>> intended recipient(s) and may contain confidential and privileged
>> information. If you are not the intended recipient(s), please reply to the
>> sender and destroy all copies of the original message. Any unauthorized
>> review, use, disclosure, dissemination, forwarding, printing or copying of
>> this email, and/or any action taken in reliance on the contents of this
>> e-mail is strictly prohibited and may be unlawful.
>>
>
>
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

RE: Split, transform and aggregate RSS XML feed

Posted by Ra...@cognizant.com.
Curiosity : Why use Apache Camel to do it if you are doing absolutely no transformation, routing, mediation? I have used it long time before but have you looked at Java Rome http://java.net/projects/rome/pages/Home

Also, if your object schema is well defined and you want something fast use Xstream
http://xstream.codehaus.org/json-tutorial.html

so solution use Rome to split RSS feed, Xstream to convert to objects and serialize to JSON. Why do we need Camel here?

-----Original Message-----
From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
Sent: Saturday, November 03, 2012 5:07 PM
To: users@camel.apache.org
Subject: Re: Split, transform and aggregate RSS XML feed

Hello,
I guess my crappy english took it place, because I think enricher is not
the thing I need.

What I need, is a RSS feed on input and the same RSS on output, but in JSON
format. I don't need to add there any other content, any other RSS, just
the transformation/converting to JSON.

The solution I have and I described here, is not ideal I guess. I was
thinking that split the RSS feed is a good idea, once it's splitted I can
parse one chunk per time, convert them into POJO classes which holds the
one feed chunk data and at the end, go through the List of POJO classes on
send them  back to browser in JSON.

Maybe, I could skipp the splitting and process the whole RSS XML feed,
maybe with XSLT, I don't know and I don't like XSLT :)

I have to figure it out somehow.


On Fri, Nov 2, 2012 at 4:59 PM, <Ra...@cognizant.com> wrote:

> I am not sure if I understand you rightly but have you looked at content
> enricher EIP. Basically you have RSS feeds that are enriched through a
> split-aggregate. Example merge RSS feeds for "USA" across multiple articles
> creating one RSS feed for "USA" etc.
>
> http://camel.apache.org/content-enricher.html
> The content enricher (enrich) retrieves additional data from a resource
> endpoint in order to enrich an incoming message (contained in the original
> exchange). An aggregation strategy is used to combine the original exchange
> and the resource exchange.
> -----Original Message-----
> From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
> Sent: Friday, November 02, 2012 8:19 PM
> To: users@camel.apache.org
> Subject: Split, transform and aggregate RSS XML feed
>
> Hello,
> currently I'm working on a case, where is RSS XML feed as data source,
> which I need to grab and parse/transform in to POJO classes structure and
> the return back as JSON.
>
> Concerning the relevant route in Camel, I have restlet as the consumer
> endpoint (there are few things needed to declare in the GET request to
> fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
> the RSS XML feed and then should follow some transformation strategy to
> POJO classes and then send  response back to browser/user (producer
> endpoint).
>
> The structure of the RSS XML feed is nothing tricky, it has simple
> structure, simply there is a tag I know, which should be used to split by,
> to get each chunk of the feed.
>
> So, I tried tokenizeXML() to split the feed. Good, it works. Then, I tried
> custom Aggregation Strategy, to get all pieces back together. Works as
> well.
> But, where in this scenario fit the transformation part? Right in the
> Aggregation Strategy? Why not, it works as well for me. But I'm not sure,
> if all that is correct.
>
> There should be separated transformation step in the route, what you say?
>
> Thanks for hints, guys!
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
> This e-mail and any files transmitted with it are for the sole use of the
> intended recipient(s) and may contain confidential and privileged
> information. If you are not the intended recipient(s), please reply to the
> sender and destroy all copies of the original message. Any unauthorized
> review, use, disclosure, dissemination, forwarding, printing or copying of
> this email, and/or any action taken in reliance on the contents of this
> e-mail is strictly prohibited and may be unlawful.
>



--
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.

Re: Split, transform and aggregate RSS XML feed

Posted by Martin Stiborský <ma...@gmail.com>.
Hello,
I guess my crappy english took it place, because I think enricher is not
the thing I need.

What I need, is a RSS feed on input and the same RSS on output, but in JSON
format. I don't need to add there any other content, any other RSS, just
the transformation/converting to JSON.

The solution I have and I described here, is not ideal I guess. I was
thinking that split the RSS feed is a good idea, once it's splitted I can
parse one chunk per time, convert them into POJO classes which holds the
one feed chunk data and at the end, go through the List of POJO classes on
send them  back to browser in JSON.

Maybe, I could skipp the splitting and process the whole RSS XML feed,
maybe with XSLT, I don't know and I don't like XSLT :)

I have to figure it out somehow.


On Fri, Nov 2, 2012 at 4:59 PM, <Ra...@cognizant.com> wrote:

> I am not sure if I understand you rightly but have you looked at content
> enricher EIP. Basically you have RSS feeds that are enriched through a
> split-aggregate. Example merge RSS feeds for "USA" across multiple articles
> creating one RSS feed for "USA" etc.
>
> http://camel.apache.org/content-enricher.html
> The content enricher (enrich) retrieves additional data from a resource
> endpoint in order to enrich an incoming message (contained in the original
> exchange). An aggregation strategy is used to combine the original exchange
> and the resource exchange.
> -----Original Message-----
> From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
> Sent: Friday, November 02, 2012 8:19 PM
> To: users@camel.apache.org
> Subject: Split, transform and aggregate RSS XML feed
>
> Hello,
> currently I'm working on a case, where is RSS XML feed as data source,
> which I need to grab and parse/transform in to POJO classes structure and
> the return back as JSON.
>
> Concerning the relevant route in Camel, I have restlet as the consumer
> endpoint (there are few things needed to declare in the GET request to
> fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
> the RSS XML feed and then should follow some transformation strategy to
> POJO classes and then send  response back to browser/user (producer
> endpoint).
>
> The structure of the RSS XML feed is nothing tricky, it has simple
> structure, simply there is a tag I know, which should be used to split by,
> to get each chunk of the feed.
>
> So, I tried tokenizeXML() to split the feed. Good, it works. Then, I tried
> custom Aggregation Strategy, to get all pieces back together. Works as
> well.
> But, where in this scenario fit the transformation part? Right in the
> Aggregation Strategy? Why not, it works as well for me. But I'm not sure,
> if all that is correct.
>
> There should be separated transformation step in the route, what you say?
>
> Thanks for hints, guys!
>
> --
> S pozdravem
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
> This e-mail and any files transmitted with it are for the sole use of the
> intended recipient(s) and may contain confidential and privileged
> information. If you are not the intended recipient(s), please reply to the
> sender and destroy all copies of the original message. Any unauthorized
> review, use, disclosure, dissemination, forwarding, printing or copying of
> this email, and/or any action taken in reliance on the contents of this
> e-mail is strictly prohibited and may be unlawful.
>



-- 
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz

RE: Split, transform and aggregate RSS XML feed

Posted by Ra...@cognizant.com.
I am not sure if I understand you rightly but have you looked at content enricher EIP. Basically you have RSS feeds that are enriched through a split-aggregate. Example merge RSS feeds for "USA" across multiple articles creating one RSS feed for "USA" etc.

http://camel.apache.org/content-enricher.html
The content enricher (enrich) retrieves additional data from a resource endpoint in order to enrich an incoming message (contained in the original exchange). An aggregation strategy is used to combine the original exchange and the resource exchange.
-----Original Message-----
From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
Sent: Friday, November 02, 2012 8:19 PM
To: users@camel.apache.org
Subject: Split, transform and aggregate RSS XML feed

Hello,
currently I'm working on a case, where is RSS XML feed as data source,
which I need to grab and parse/transform in to POJO classes structure and
the return back as JSON.

Concerning the relevant route in Camel, I have restlet as the consumer
endpoint (there are few things needed to declare in the GET request to
fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
the RSS XML feed and then should follow some transformation strategy to
POJO classes and then send  response back to browser/user (producer
endpoint).

The structure of the RSS XML feed is nothing tricky, it has simple
structure, simply there is a tag I know, which should be used to split by,
to get each chunk of the feed.

So, I tried tokenizeXML() to split the feed. Good, it works. Then, I tried
custom Aggregation Strategy, to get all pieces back together. Works as well.
But, where in this scenario fit the transformation part? Right in the
Aggregation Strategy? Why not, it works as well for me. But I'm not sure,
if all that is correct.

There should be separated transformation step in the route, what you say?

Thanks for hints, guys!

--
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.

RE: Split, transform and aggregate RSS XML feed

Posted by Ra...@cognizant.com.
Have you written a Content Enricher?

-----Original Message-----
From: Martin Stiborský [mailto:martin.stiborsky@gmail.com]
Sent: Friday, November 02, 2012 8:19 PM
To: users@camel.apache.org
Subject: Split, transform and aggregate RSS XML feed

Hello,
currently I'm working on a case, where is RSS XML feed as data source,
which I need to grab and parse/transform in to POJO classes structure and
the return back as JSON.

Concerning the relevant route in Camel, I have restlet as the consumer
endpoint (there are few things needed to declare in the GET request to
fetch needed RSS feed). In the middle is a Camel HTTP component to fetch
the RSS XML feed and then should follow some transformation strategy to
POJO classes and then send  response back to browser/user (producer
endpoint).

The structure of the RSS XML feed is nothing tricky, it has simple
structure, simply there is a tag I know, which should be used to split by,
to get each chunk of the feed.

So, I tried tokenizeXML() to split the feed. Good, it works. Then, I tried
custom Aggregation Strategy, to get all pieces back together. Works as well.
But, where in this scenario fit the transformation part? Right in the
Aggregation Strategy? Why not, it works as well for me. But I'm not sure,
if all that is correct.

There should be separated transformation step in the route, what you say?

Thanks for hints, guys!

--
S pozdravem
Martin Stiborský

Jabber: stibi@njs.netlab.cz
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.