How to create Streaming RSS Feed with Rome?

120 views Asked by At

I am trying to implement an application that exposes API to get RSS feed of the items in the database. I am using Rome to construct the SyndFeed.

Here is the code snipped that I am using. Just copying it here as well for easy reference

SyndFeed feed = getFeed(req);
String feedType = req.getParameter(FEED_TYPE);
feedType = (feedType!=null) ? feedType : _defaultFeedType;
feed.setFeedType(feedType);
//..... Loop to add SyndEntry objects to SyndFeed
res.setContentType(MIME_TYPE);
SyndFeedOutput output = new SyndFeedOutput();
output.output(feed,res.getWriter());

This works pretty well for limited items in the database. But as SyndFeed object maintains all entries in memory, it shows memory issues with for huge number of records (say 100,0000).

So my question here is, is there a concept called streaming RSS? Is there any way I can start writing the SyndEntry objects to outputstream while iterating through the list?

Hope my question is clear. Any help is appreciated.

0

There are 0 answers