camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Split, transform and aggregate RSS XML feed
Date Sat, 03 Nov 2012 11:45:28 GMT
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ý
<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, <Ramkumar.Iyer@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

Mime
View raw message