RSS Module Reference
The Mule RSS support makes it possible to integrate easily with RSS feeds via the Rome project.
One of the most common patterns is for integrating with RSS is polling for feed updates. With Mule this can be done easily. You must first write your class which receives an RSS Syndication Entry:
By default the RSS feed will be split into entries for you, so for each entry the component method will be invoked with the next entry in the feed. The flow configuration would look like:
The Atom Http endpoint respects ETags and the 304 Not Modified response code by default, so you don't need to worry about consuming unnecessary updates.
Accessing the Feed itself
If you want access to the feed itself, it is available via a header on the current message called 'feed.object'. You could have this injected into your entry point method using annotations -
The @Expr annotation is only available in the the Mule 3.0.1 SNAPSHOT or later.
If you want want to process the Feed in its entirety (not have it split into Entry objects) you can set the the following flag on the endpoint -
Now your component will only be invoked once for each feed change no matter how many entries were added or updated. The method on you component should expect a
com.sun.syndication.feed.synd.SyndFeed object or just a
org.w3c.dom.Document if you want to process the XML model or even an
java.lang.String to get a raw representation.
Mixing Http and RSS endpoints
rss:endpoint elements are a shortcut for creating a polling http endpoint and splitting a feed. If you are using another non-polling HTTP endpoint in your configuration you will need to configure a HTTP polling endpoint as well and reference it on your atom endpoint.
Accessing feeds over other Protocols
You can process feeds and process them using other Mule connectors such as JMS, File or XMPP. To do this the atom feed needs to be served over the connector, i.e. an rss document is sent over JMS or polled from a file. The rss schema defines a
<rss:feed-splitter/> that can split messages received from an endpoint.
Processing feeds without the RSS endpoint
For reference the follow example shows the explicit configuration for reading an atom feed without using the
Note that the
rss:entry-last-updated-filter should come after the
<rss:feed-splitter/> since you need to split the feeds so that the filter can process them. Also note that we do not set a
lastUpdate date on the filter which implies the default behaviour that all available entries will be read and then only new entries since the last read will be processed.
Will split the entries of a feed into single entry objects. Each entry will be a separate message in Mule.
Will filter RSS entry objects based on their last update date. This is useful for filtering older entries from the feed. This filter works only on RSS SyndEntry objects not SyndFeed objects.
The date from which to filter events from. Any entries that were last updated before this date will not be accepted. The date format is: yyyy-MM-dd hh:mm:ss, for example 2008-12-25 13:00:00. If only the date is important you can omit the time part. You can set the value to 'now' to set the date and time that the server is started. Do not set this attribute if you want to receive all available entries then any new entries going forward. This is the default behaviour and suitable for many scenarios.
Whether an entry should be accepted if it doesn't have a Last Update date set.