Skip to content

This project shows the RSS Demo Data and Metadata Adapters and how they can be plugged into Lightstreamer Server and used to feed the Lightstreamer RSS News Reader Demo

License

Notifications You must be signed in to change notification settings

Lightstreamer/Lightstreamer-example-RSS-adapter-java

Repository files navigation

Lightstreamer - RSS News Demo - Java Adapter

This project shows the RSS Demo Data and Metadata Adapters and how they can be plugged into Lightstreamer Server and used to feed the Lightstreamer - RSS News Demo - HTML Client front-end.
The RSS News Demo is a simple news aggregator application based on Lightstreamer.

Details

The project is comprised of source code and a deployment example.

Dig the Code

The source code is divided into three folders.

RSS Data Adapter

Contains the source code for the RSS Data Adapter that polls all the feeds currently subscribed to and delivers the updates to the Server. It also delivers the list of subscribed feeds for each user.

Metadata Adapter

Contains the source code for a Metadata Adapter to be associated with the RSS Demo Data Adapter. This Metadata Adapter inherits from LiteralBasedProvider. It coordinates, together with the Data Adapter, the association among items, users, and subscribed feed.

RSS Reader

Contains the source code for a basic RSS news reader.
See the source code comments for further details.

The Adapter Set Configuration

This Adapter Set is configured and will be referenced by the clients as RSSDEMO.

The adapters.xml file for the RSS News Demo, should look like:

<?xml version="1.0"?>
<adapters_conf id="RSSDEMO">

<metadata_adapter_initialised_first>Y</metadata_adapter_initialised_first>

<metadata_provider>
  <adapter_class>com.lightstreamer.examples.rss_demo.adapters.RSSMetadataAdapter</adapter_class>

  <!-- <param name="search_dir">.</param> 
  <param name="max_bandwidth">500</param>
  <param name="max_frequency">0</param>
  <param name="buffer_size">0</param> -->

  <param name="item_family_1">rss_items_.*</param>
  <param name="modes_for_item_family_1">DISTINCT</param>
  <param name="item_family_2">rss_info_.*</param>
  <param name="modes_for_item_family_2">COMMAND</param>
</metadata_provider>

<data_provider name="RSS_ADAPTER">
  <adapter_class>com.lightstreamer.examples.rss_demo.adapters.RSSDataAdapter</adapter_class>
  <param name="config_file">rss_reader_conf.txt</param>
</data_provider>

</adapters_conf>

NOTE: not all configuration options of an Adapter Set are exposed by the file suggested above. You can easily expand your configurations using the generic template, see the Java In-Process Adapter Interface Project for details.

Please refer here for more details about Lightstreamer Adapters.

RSS Reader Configuration

The rss_reader_conf.txt configuration file used by the adapter (this is an example configuration, you can modify it to your liking):

threadTimeout = 20
wait4Info = 60000
snapLength = 6
substituteSnapLength = 6
maxNumFeed = 300
maxByteFeed = 100000
maxNumThreads = 100
minNumRunningThreads = 3
#proxyHost = proxy1.mycomp.com
#proxyPort = 3128

Please refer here for more details about Lightstreamer Adapters.

Install

If you want to install a version of the RSS News Demo in your local Lightstreamer Server, follow these steps:

  • Download Lightstreamer Server (Lightstreamer Server comes with a free non-expiring demo license for 20 connected users) from Lightstreamer Download page, and install it, as explained in the GETTING_STARTED.TXT file in the installation home directory.
  • Make sure that Lightstreamer Server is not running.
  • Get the deploy.zip file of the latest release, unzip it, and copy the RSSDemo folder into the adapters folder of your Lightstreamer Server installation.
  • [Optional] Customize the logging settings in log4j configuration file: RSSDemo/classes/log4j2.xml.
  • Launch Lightstreamer Server.
  • Test the Adapter, launching the Lightstreamer - RSS News Demo - HTML Client listed in Clients Using This Adapter.

Build

To build your own version of rss-adapter-java-x.y.z.jar instead of using the one provided in the deploy.zip file from the Install section above, you have two options: either use Maven (or other build tools) to take care of dependencies and building (recommended) or gather the necessary jars yourself and build it manually. For the sake of simplicity only the Maven case is detailed here.

Maven

You can easily build and run this application using Maven through the pom.xml file located in the root folder of this project. As an alternative, you can use an alternative build tool (e.g. Gradle, Ivy, etc.) by converting the provided pom.xml file.

Assuming Maven is installed and available in your path you can build the demo by running

 mvn install dependency:copy-dependencies 

See Also

Client Using This Adapter

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer SDK for Java In-Process Adapters since version 8.0.
  • For a version of this example compatible with Lightstreamer SDK for Java Adapters versions 7.4.x, please refer to this tag.
  • For a version of this example compatible with Lightstreamer SDK for Java Adapters versions 7.0 to 7.3, please refer to this tag.
  • For a version of this example compatible with Lightstreamer SDK for Java Adapters version 6.0, please refer to this tag.
  • For a version of this example compatible with Lightstreamer SDK for Java Adapters version 5.1, please refer to this tag.

About

This project shows the RSS Demo Data and Metadata Adapters and how they can be plugged into Lightstreamer Server and used to feed the Lightstreamer RSS News Reader Demo

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages