Access Keys:
Skip to content (Access Key - 0)
Cancel    
Cancel   
 

RSS Module Reference

Oct 01, 2010 13:28

George Hoffer

Sep 15, 2014 17:37

Mulesoft Current Mule Documentation

RSS Module Reference

Mulesoft Documentation Page

Contents

RSS Module Reference

The Mule RSS support makes it possible to integrate easily with RSS feeds via the Rome project.

 

 Contents

 

Consuming Feeds

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:

EntryReceiver.java


By default the RSS feed is split into entries for you, so for each entry, the component method invokes with the next entry in the feed. Flow configuration:

 

ETags

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 -

EntryReceiver.java

The @Expr annotation is only available in the Mule Community Edition.

If you want to process the Feed in its entirety (not have it split into Entry objects) you can set the following flag on the endpoint:

Now your component invokes once for each feed change no matter how many entries are added or updated. The method for your 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.io.InputStream or java.lang.String to get a raw representation.

FeedReceiver.java

Mixing HTTP and RSS endpoints

The 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, 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, 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.

Over JMS

Over a File

Processing Feeds Without the RSS Endpoint

For reference the follow example shows the explicit configuration for reading an Atom feed without using the rss:endpoint.

The rss:entry-last-updated-filter comes after the <rss:feed-splitter/> because you need to split the feeds so that the filter can process them. Also we do not set a lastUpdate date on the filter, which implies the default behavior that all available entries are read, and then only new entries since the last read are processed.

 

Configuration Reference

RSS Module


RSS is a popular syndication format used by many websites to provide a feed of data such as news or updates.

Transformers

These are transformers specific to this transport. Note that these are added automatically to the Mule registry at start up. When doing automatic transformations these will be included when searching for the correct transformers.

Name

Description

object-to-feed-transformer

Transforms the payload of the message to a com.sun.syndication.feed.synd.SyndFeed instance.

Filters

Filters can be used to control which data is allowed to continue in the flow.

Name

Description

entry-last-updated-filter

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.

feed-last-updated-filter

Will filter the whole RSS Feed based on its last update date. This is useful for processing a feed that has not been updated since a specific date. This filter works only on RSS SyndFeed objects.

Feed splitter

Will split the entries of a feed into single entry objects. Each entry will be a separate message in Mule.

Child Elements of <feed-splitter...>

Name

Cardinality

Description