Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Sep 2006
    Location
    Victoria
    Posts
    2

    Adapter Database Pulling

    First the context in which this question will be asked. I am very interested in what Lightstreamer could do with respect to "real-time" data streaming to our web page from our own database (currently we are working with Sybase and MySQL).

    I have developed apps for the web using PHP, Perl, and now VB and C#. I have not had the pleasure of diving into Java yet.

    I have looked at the src java files for the ReusableMetaAdapters in the trial download sdk sub folder. Obviously with my experience with the other languages, Java seems quite friendly.

    However, I am still unsure of where to start in developing an adapter that will pull the table records from our database.

    The "LS_Generic_Adapters_Javadoc/" files and information seem extensive in the information it provides regarding the built-in classes and methods, but unfortunatley I need a more basic pointer to instructions that say "Here is where you start->This is what you change->This is how you implement".

    Thanks for any help with this. I'm definitely excited to see if this is our solution.

    cheers
    jws

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    First of all we need to make clear what is a metadata adapter and what is instead a data adapter.
    A metadata adapter is an object which "decides" the access from the client (for example user authentication ) implementing the MetadataProvider interface (http://www.lightstreamer.com/docs/ad...aProvider.html) while a data adapter is the object which sends data to Lightstreamer kernel (gathering them from DB in your case) implementing the DataProvider interface ( http://www.lightstreamer.com/docs/ad...aProvider.html ).

    ReusableMetadataAdapters are obviously Metadata adapters. To start coding with Lightstreamer you may better start from looking/modifying the tutorial's Data Adapter ( lightstreamer_folder/sdk_for_adapters/examples/StockListDemo/src_adapter ) and then return to Metadata later on.

    Hope that helps, please let me know if you need further explanations.
    Bye!

  3. #3
    Member
    Join Date
    Sep 2006
    Location
    Victoria
    Posts
    2
    Thanks Mone.

    I'm still unclear on the role of a Meta Adapter, but if it's the Data Adapter I should focus on then that's ok.

    I've checked out the src in "example" directory for the StockList data adapter.

    It probably all comes down to my unfamiliarity with Java, but it stills seems a bit muddy. Let me know, if you can, if my assumptions are correct.

    In ExternalFeedSimulator.java the MyProducer object is where the data is coming from, and if I am able to alter this to do a database query, instead of serving up internal hash values, then I should be on the right road to feeding the Adapter with the data I want.

    Am I close?

    Thanks.

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    Excalibur,

    That's correct. The MyProducer class simulates a data feed. If you replace its random generation code with an access to some actual feed (like a database), then you can push your own data.

    The main difference is that a database is a synchronous feed (unless you use triggers), while a Lightstreamer Data Adapter interfaces offer asynchronous interfaces (to offer zero latency). That simply means that for synchronous feeds your Data Adapter will usually have to poll the feed to retrieve fresh data.

  5. #5
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Yes, you are on the right way.

    Probably what confuse you in the code style is the use of inner classes. I will not explain that concept here (is full of docs out there), just know that in java you can implement classes inside other classes (so inner classes).

    In our adapter we have:
    • DemoDataAdapter
      This is the object that implements the DataProvider interface and so comunicates with Lightstreamer kernel.
      The subscribe/unsubscribe method receives the requests to subscribe/unsubscribe (of course...) items (ie which items the various clients wants)
    • MyFeedListener
      Is an inner class. An instance of this class will be passed to the "data-generator" class ExternalFeedSimulator.
      This class receives (implementing ExternalFeedListener) updates through the onEvent and then forwards them to Lightstreamer kernel:
      Code:
      listener.update(itemName, currentValues, isSnapshot);
    • ExternalFeedSimulator
      This is the object that creates data (the generator is his inner class MyProducer). In your case this object will not generate data but will pull data from DB


    HTH
    Bye!

 

 

Similar Threads

  1. Database Feed
    By mode_vigilante in forum Adapter SDKs
    Replies: 16
    Last Post: January 27th, 2012, 04:58 PM
  2. CLient Pulling Support
    By usama in forum Client SDKs
    Replies: 2
    Last Post: March 19th, 2010, 11:03 AM
  3. How And Where To Specify Database As Data Feed?
    By devidasan in forum Adapter SDKs
    Replies: 1
    Last Post: March 17th, 2009, 12:00 PM
  4. the many concurrent connection to database.
    By hungn in forum Adapter SDKs
    Replies: 2
    Last Post: August 23rd, 2007, 10:21 AM
  5. Database datafeed
    By Sinead in forum Adapter SDKs
    Replies: 4
    Last Post: February 14th, 2007, 04:47 PM

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 06:56 AM.