Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Nov 2009
    Location
    Houston
    Posts
    2

    Unhappy DataAdapter Service

    Hi,

    I've created a data adapter that is started with a bat file, and of course this works without any problems. So I decided to see how I could convert this to a windows service. Using VS2010, I created a class that inherits from the windows "ServiceBase" class. I also implement the Lightstreamer IDataProvider interface in this class. The problem I'm encountering is the ServiceBase implements their OnStart/OnStop methods while at the same time I need to implement the Lightstreamer Init method. I can get one set of methods called, but not the other. So in short I see the service starting, but the Init method is never called.

    After viewing some other forum posts it would seem that this is a generic problem others are encountering. I'm seeing requests to have the Lightstreamer server to start it's data adapters or somehow have the adapters auto start. In a production environment I really don't see an admin having to remember to restart the adapters after a machine reboot/reconfiguration. Ideally the Lightstreamer server would have a configuration parameter that lists it's adapters for startup. I'm thinking most environments run their adapters on the same machine as the server - take a poll!

    Thanks,
    Bruce

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    975
    A Remote Adapter can be launched in two ways:
    • through the supplied DotNetServer_N2.exe, as shown in DOCS-SDKs\sdk_adapter_dotnet\examples\Remote_StockListD emo_Adapters\Deployment\Deployment_DotNet_Server;
    • by writing a custom launcher, as shown in DOCS-SDKs\sdk_adapter_dotnet\examples\Remote_StockListD emo_Adapters\Deployment\Deployment_DotNet_Server(c ustom); examples, of custom launcher code are shown both in DOCS-SDKs\sdk_adapter_dotnet\examples\Remote_StockListD emo_Adapters\src_standalone_launcher and in the online tutorial.

    The latter method allows you to add any kind of customization.
    In your case, the onStart callback would replace the main method of the example code.
    The call to the Start method on the DataProviderServer instance (actually triggered by the main method) in turn triggers the Init call on the IDataProvider instance.

    About launching Remote Adapters by the Server itself, this can be achieved by customizing the supplied Proxy Adapters.
    By wrapping the com.lightstreamer.adapters.remote.data.NetworkedDa taProvider (or RobustNetworkedDataProvider) class, you could hook the init method and launch the Remote Adapter there,
    with any configuration parameters specified within the <data_provider> element in adapters.xml available.

    By the way, note that the com.lightstreamer.adapters.remote.data.PipedDataPr ovider actually runs the Remote Adapter on the local machine, but this technique is not advised for production use.

  3. #3
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    517
    Hi Bruce,

    Pardon my lack of knowledge on Windows Service implementation, but why can't you simply override the onStart method to implement the initialization of the Lightstreamer code?

    Alessandro

  4. #4
    Member
    Join Date
    Nov 2009
    Location
    Houston
    Posts
    2
    Hi Alessandro,

    Sorry I didn't reply sooner, but I was involved in another project. Anyway I revisited my code and found a solution. When the service is started, I have the main program instantiate the "service" instance. This causes the "OnStart" method to be called, this method in turn instantiates the class I call the "DataAdapterLauncher". This class was the piece I was missing. It has the DataProviderServer instance with the sockets setup and of course it wires up the instance I call "DataAdapter". The DataAdapter instance is implements the LightStreamer logic.

    Now the only piece missing is something to wrap all this together. Since the Lightstreamer must be started "first", then the data adapters I was thinking I could write a service that starts the Lightstreamer service, wait for it to complete, then start the data adapter service.

    Thanks,
    Bruce

 

 

Similar Threads

  1. Web Service Data Adapter ? How can I do ?
    By intelsmart in forum Adapter APIs
    Replies: 1
    Last Post: April 11th, 2012, 10:03 AM
  2. Replies: 4
    Last Post: February 3rd, 2011, 11:33 AM
  3. How to debug .NET DataAdapter
    By msgiribabu in forum Adapter APIs
    Replies: 1
    Last Post: January 21st, 2011, 02:38 PM
  4. DataAdapter with XML
    By Irwin in forum Adapter APIs
    Replies: 11
    Last Post: April 30th, 2010, 09:42 AM
  5. DataAdapter using XML
    By amarin in forum Adapter APIs
    Replies: 4
    Last Post: August 21st, 2008, 10:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 10:16 AM.