Skip to content
This project contains the source code and all the resources needed to install a .NET version of the StockListDemo Data and Metadata Adapters
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Update lib instructions Jan 25, 2019
src
.gitattributes
.gitignore First commit Aug 6, 2013
LICENSE
README.md Align Jan 28, 2019
adapter-logo.png
generalarchitecture.png
generalarchitecture_new.png use title case and resize architecture png Jan 14, 2014

README.md

Lightstreamer - Stock-List Demo - .NET Adapter

The Stock-List demos simulate a market data feed and front-end for stock quotes. They show a list of stock symbols and updates prices and other fields displayed on the page in real-time.

This project contains the source code and all the resources needed to install a .NET version of the Stock-List Demo Data Adapter and Metadata Adapters.

As an example of Clients Using This Adapter, you may refer to the Lightstreamer - Basic Stock-List Demo - HTML Client and view the corresponding Live Demo.

Details

Lightstreamer Server exposes native Java Adapter interfaces. The .NET interfaces are added through the Lightstreamer Adapter Remoting Infrastructure (ARI).

The Architecture of Adapter Remoting Infrastructure for .NET.

General Architecture

You'll find more details about the SDK for .NET Standard Adapters at .NET Interfaces in the Lightstreamer - "Hello World" Tutorial - .NET Adapter project.

Dig the Code

This project includes the implementation of the IDataProvider interface and the IMetadataProvider interface for the Stock-List Demo.

The application is divided into 4 main classes.

  • StockList.cs: this is a C#/.NET porting of the Lightstreamer - Stock-List Demo - Java Adapter. It inherits from the IDataProvider interface and calls back Lightstreamer through the IItemEventListener interface. Use it as a starting point to implement your custom data adapter.
  • ExternalFeed.cs: this component simulates an external data feed that supplies quote values for all the stocks needed for the demos.
  • StandaloneLauncher.cs: this is a stand-alone executable that launches both the Data Adapter and the Metadata Adapter for the .NET Stock-List Demo example. It redirects sockets connections from Lightstreamer to the .NET Servers implemented in the LS .NET Standard Adapter SDK library.
  • Log4NetLoggerProviderWrapper.cs: used by the stand-alone executable to forward the log produced by the LS .NET Standard Adapter SDK library to the application logging system, based on NLog.

Check out the sources for further explanations.

The Metadata Adapter functionalities are absolved by the LiteralBasedProvider, a simple Metadata Adapter already included in the .NET Standard Adapter SDK binaries, which is enough for all demo clients. See also Lightstreamer - Reusable Metadata Adapters - .NET Adapter.

Install

If you want to install a version of this demo in your local Lightstreamer server, follow these steps:

  • Download the latest Lightstreamer distribution (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.
  • Get the deploy.zip file of the latest release and unzip it
  • Plug the Proxy Data Adapter and the Proxy MetaData Adapter into the Server: go to the Deployment_LS folder and copy the DotNetStockList directory and all of its files to the adapters folder of your Lightstreamer Server installation.
  • Alternatively, you may plug the robust versions of the Proxy Data Adapter and the Proxy MetaData Adapter: go to the Deployment_LS(robust) folder and copy the DotNetStockList directory and all of its files into adapters. This Adapter Set demonstrates the provided "robust" versions of the standard Proxy Data and Metadata Adapters. The robust Proxy Data Adapter can handle the case in which a Remote Data Adapter is missing or fails, by suspending the data flow and trying to connect to a new Remote Data Adapter instance. The robust Proxy Metadata Adapter can handle the case in which a Remote Metadata Adapter is missing or fails, by temporarily denying all client requests and trying to connect to a new Remote Data Adapter instance. See the comments embedded in the generic adapters.xml file template, DOCS-SDKs/adapter_remoting_infrastructure/doc/adapter_robust_conf_template/adapters.xml, for details. Note that this extended Adapter Set also requires that the client is able to manage the case of missing data. Currently, only the Lightstreamer - Stock-List Demo - HTML Client and the Lightstreamer - Framed Stock-List Demo - HTML Client front-ends have such ability.
  • Run the DotNetStockListDemoLauncher.bat script under the Deployment_DotNet_Adapters directory. The script runs a .NET Core application which hosts both the Remote Data Adapter and the Remote Metadata Adapter for the .NET Stock-List Demo.
  • Launch Lightstreamer Server. The Server startup will complete only after a successful connection between the Proxy Adapters and the Remote Adapters.
  • Test the Adapter, launching one of the clients listed in Clients Using This Adapter.
    • To make the Stock-List Demo front-end pages consult the newly installed Adapter Set, you need to modify the front-end pages and set the required Adapter Set name to STOCKLISTDEMO_REMOTE when creating the LightstreamerClient instance. So a line like this:
      var sharingClient = new LightstreamerClient(hostToUse,"DEMO");
      becomes like this:
      var sharingClient = new LightstreamerClient(hostToUse, "STOCKLISTDEMO_REMOTE");
      (you don't need to reconfigure the Data Adapter name, as it is the same in both Adapter Sets).
    • As the referred Adapter Set has changed, make sure that the front-end no longer shares the Engine with demos. So a line like this:
      sharingClient.connectionSharing.enableSharing("DemoCommonConnection","ls/","SHARE_SESSION", true);
      should become like this:
      sharingClient.connectionSharing.enableSharing("RemoteStockListConnection","ls/","SHARE_SESSION", true);
      The Stock-List Demo web front-end is now ready to be opened. The front-end will now get data from the newly installed Adapter Set.

Please note that the .NET Remote Adapters connects to Proxy Adapters, not vice versa.

Build

Build the .NET Stock-List Demo Data Adapter

To build your own version of DotNetStockListDataAdapter.dll, instead of using the one provided in the deploy.zip file from the Install section above, follow these steps:

  • Download this project.
  • Create a project for ".NET Core library" template and name it "DotNetStockListDataAdapter".
  • Include in the project the sources src/src_data_adapter.
  • Get the binaries files of the Lightstreamer .NET Standard Adapters Server library from NuGet Lightstreamer.DotNetStandard.Adapters, copy it into the lib directory and add it as a reference for the project; or more simply, use directly the "NuGet Package Manager" looking for 'Lightstreamer Adapters' and installing the Lightstreamer.DotNetStandard.Adapters package.
  • Build Solution

Build the Stand-Alone Launcher

To build your own version of the Stand-Alone Launcher, follow these steps:

  • Create a project for ".NET Core App Console" template and name it "TestAdapter".
  • Include in the project the source src/src_standalone_launcher
  • Include reference to the .NET Stock-List Demo Data Adapter binaries you have built in the previous step.
  • Get the binaries files of the Lightstreamer .NET Standard Adapters Server library from NuGet Lightstreamer.DotNetStandard.Adapters, copy it into the lib directory and add it as a reference for the project; or more simply, use directly the "NuGet Package Manager" looking for 'Lightstreamer Adapters' and installing the Lightstreamer.DotNetStandard.Adapters package.
  • Get the binaries files of the NLog library from NuGet, copy it into the lib directory and add it as a reference for the project; or more simply, use directly the "NuGet Package Manager" looking for 'NLog' and installing the NLog package.
  • Make sure that the startup object is the TestAdapter.StandaloneLauncher class.
  • Build Solution

See Also

Clients Using This Adapter

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer SDK for .NET Standard Adapters version 1.11 or newer.
  • For instructions compatible with Lightstreamer SDK for .NET Adapters version 1.10, please refer to this tag.
You can’t perform that action at this time.