Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview of the ServiceMix 2.x RSS Binding Example

The following procedure describes how to run the RSS Binding example in ServiceMix and provides details regarding what the RSS Binding does. For information on the business use case, please refer to: Use Case for RSS Binding.

The RSS Binding example illustrates:

...

The source code for the RSS Binding example is located in the ServiceMix installation directory under the examples\rss-binding directory in the servicemix.xml file. It is recommended that you refer to the source code while reading this document.

This example shows how to monitor RSS feed for changes. The main component polls the RSS periodically and when an update is found the new RSS items are send to a trace component for logging.

Running the RSS Binding Example

  1. From a command shell, go to the RSS Binding example directory:
    Code Block
    cd [servicemix_install_dir]\examples\rss-binding
    
    where servicemix_install_dir is the directory in which ServiceMix was installed originally.
  2. Then type:
    Code Block
    [servicemix_install_dir]\bin\servicemix servicemix.xml
    
Tip
titleHandy Hint

Add $SERVICEMIX_HOME/bin directory to $PATH variable to simplify execution of the examples.


Stopping the RSS Binding Example

To terminate the RSS Binding example, type "CTRL-C" in the command shell in which it is running and answer "y" to the "Terminate batch job (y/n)?" question.

How it Works

The diagram below illustrates the flow of messages through the RSS Binding components:

...

Code Block
  
<item>
<title>Bush supporters' cars allegedly defaced by war veteran</title>
<link>http://www.cnn.com/rssclick/2005/US/12/16/bush.vandalism.ap/index.html?sec
tion=cnn_topstories</link>
<description>Read full story for latest details.</description>
<pubDate>Sat, 17 Dec 2005 00:52:01 GMT</pubDate>
<guid isPermaLink="false">http://www.cnn.com/rssclick/2005/US/12/16/bush.vandali
sm.ap/index.html?section=cnn_topstories</guid>
</item>
<item>
<title>Stern says goodbye to terrestrial radio</title>
<link>http://www.cnn.com/rssclick/2005/SHOWBIZ/12/16/stern.last.day.ap/index.htm
l?section=cnn_topstories</link>
<description>Read full story for latest details.</description>
<pubDate>Sat, 17 Dec 2005 02:13:07 GMT</pubDate>
<guid isPermaLink="false">http://www.cnn.com/rssclick/2005/SHOWBIZ/12/16/stern.l
ast.day.ap/index.html?section=cnn_topstories</guid>
</item>
<item>
<title>Living with the threat of sudden violence</title>
<link>http://www.cnn.com/rssclick/2005/WORLD/meast/12/16/btsc.cooper/index.html?
section=cnn_topstories</link>
<description>"Goddamned son of a bitch!"</description>
<pubDate>Fri, 16 Dec 2005 19:38:29 GMT</pubDate>
<guid isPermaLink="false">http://www.cnn.com/rssclick/2005/WORLD/meast/12/16/bts
c.cooper/index.html?section=cnn_topstories</guid>
</item>

Details

The following table provides more details about the function of each component and bean in the servicemix.xml file:

Component or Bean ID

Description

rss

This component polls RSS feeds for changes and is implemented by RssPollingComponent class. The property urlStrings defines the RSS feeds to be monitored. When one of the RSS feeds being monitored is updated, this component will convert the content of the RSS feed into a normalized message and send it to a trace component via Normalized Message Router (NMR).

trace

This component accepts a normalized message and display its content to the console.

Related Documentation

For more information on the following topics please see:

...