Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Copy edits + rephrased some text

...

Code Block
rss:rssUri

Where rssUri is the URI to the RSS feed to poll.

You can append query options to the URI in the following format, ?option=value&option=value&...

Options

Property

Default

Description

splitEntries

true

If true, Camel will poll the feed and for the subsequent polls return each entry splits a feed into its individual entries and returns each entry, poll by poll. If the For example, if a feed contains 7 seven entries then , Camel will return returns the first entry on the first poll, the 2nd second entry on the next second poll, until and so on. When no more entries where as Camel will do a new update on the are left in the feed, Camel contacts the remote RSS URI to obtain a new feed. If false then , Camel will poll obtains a fresh feed on every invocationpoll and returns all of the feed's entries.

filter

true

Is only used by the split entries to filter the entries to return. Camel will default use the UpdateDateFilter that only return Use in combination with the splitEntries option in order to filter returned entries. By default, Camel applies the UpdateDateFilter filter, which returns only new entries from the feed. So the client consuming from the feed never receives the same , ensuring that the consumer endpoint never receives an entry more than once. The filter will return orders the entries ordered by chronologically, with the newest returned last.

lastUpdate

null

Is only used by the filter, as the starting timestamp for selection never entries Use in combination with the filter option to block entries earlier than a specific date/time (uses the entry.updated timestamp). Syntax The format is: yyyy-MM-ddTHH:MM:ss. Example: 2007-12-24T17:45:59.

feedHeader

true

Sets Specifies whether to add the ROME SyndFeed object as a header.

sortEntries

false

If splitEntries is true, this sets specifies whether to sort those the entries by updated date.

consumer.delay

60000

Delay in millis milliseconds between each poll.

consumer.initialDelay

1000

Millis Milliseconds before polling starts.

consumer.userFixedDelay

false

Set to true to use fixed delay between pools, otherwise fixed rate is used. See ScheduledExecutorService in JDK for details.

Exchange data types

Camel will set initializes the in In body on the returned Exchange with a ROME SyndFeed. Depending on the value of the splitEntries flag, Camel will returns either return a SyndFeed with one SyndEntry or a java.util.List of SyndEntrys.

Option

Value

Behavior

splitEntries

true

Only a A single entry from the currently being processed current feed is set in the new exchange feed.

splitEntries

false

The entires entire list of entries from the current feed is set in the new exchange feed.

Message Headers

Header

Description

org.apache.camel.component.rss.feed

Camel 1.x: The entire SyncFeed object.

CamelRssFeed

Camel 2.0: The entire SyncFeed object.

RSS Dataformat

The RSS component ships with an RSS dataformat that can be used to convert between String (as XML) and ROME RSS model objects.

  • marshal = from ROME SyndFeed to XML String
  • unmarshal = from XML String to ROME SyndFeed

A route using this would look something like this:

Wiki Markup
{snippet:id=ex|lang=java|url=camel/trunk/components/camel-rss/src/test/java/org/apache/camel/dataformat/rss/RssDataFormatTest.java}

The idea purpose of this feature is to be able make it possible to use Camel's lovely built-in expressions for manipulating RSS messages. As shown below, an XPath expression can be used to filter the RSS message:

...

To merge multiple incoming feeds into a single feed, you can utilize a apply the custom aggregator, AggregationCollection, provided with camel-rss. An example usage would look something like thisFor example:

Wiki Markup
{snippet:id=ex|lang=java|url=camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssCustomAggregatorTest.java}

Here we use a Seda queue to gather up entries from two RSS feeds. The entries are then fed into a the custom aggregator which combines these entries into a single ROME SyndFeed object.

Filtering entries

You can filter out entries quite easily by using XPath, as shown in the data format section above. You can also utilize exploit Camel's Bean Integration to implement your own conditions. For instance, a filter equivalent to the XPath example above would be:

...

The custom bean for this would be:

Wiki Markup
{snippet:id=ex2|lang=java|url=camel/trunk/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssFilterTest.java}

...