RSS Component
The rss: component is used for polling RSS feeds. Camel will default poll the feed every 60th seconds.
Maven users will need to add the following dependency to their pom.xml
for this component:
Note: The component currently only supports polling (consuming) feeds.
Camel-rss internally uses a patched version of ROME hosted on ServiceMix to solve some OSGi class loading issues.
URI format
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
confluenceTableSmallProperty | Default | Description |
---|---|---|
|
| If |
|
| Use in combination with the |
|
| Camel 2.5: Sets whether all entries identified in a single feed poll should be delivered immediately. If true, only one entry is processed per consumer.delay. Only applicable when splitEntries is set to true. |
|
| Use in combination with the |
|
| Specifies whether to add the ROME |
|
| If |
|
| Delay in milliseconds between each poll. |
|
| Milliseconds before polling starts. |
|
| Set to |
username | Camel 2.16: For basic authentication when polling from a HTTP feed | |
password | Camel 2.16: For basic authentication when polling from a HTTP feed |
Exchange data types
Camel initializes the In body on the Exchange with a ROME SyndFeed
. Depending on the value of the splitEntries
flag, Camel returns either a SyndFeed
with one SyndEntry
or a java.util.List
of SyndEntrys
.
Option | Value | Behavior |
---|---|---|
|
| A single entry from the current feed is set in the exchange. |
|
| The entire list of entries from the current feed is set in the exchange. |
Message Headers
confluenceTableSmallHeader | Description |
---|---|
| The entire |
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 XMLString
- unmarshal = from XML
String
to ROMESyndFeed
A route using this would look something like this:
If the URL for the RSS feed uses query parameters, this component will understand them as well, for example if the feed uses alt=rss
, then you can for example do
from("rss:http://someserver.com/feeds/posts/default?alt=rss&splitEntries=false&consumer.delay=1000").to("bean:rss");
Filtering entries
You can filter out entries quite easily using XPath, as shown in the data format section above. You can also exploit Camel's Bean Integration to implement your own conditions. For instance, a filter equivalent to the XPath example above would be: