-
September 28th, 2006, 09:43 PM
#1
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
-
September 29th, 2006, 11:32 AM
#2
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!
-
October 2nd, 2006, 05:58 PM
#3
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.
-
October 3rd, 2006, 09:18 AM
#4
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.
-
October 3rd, 2006, 09:38 AM
#5
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
-
By mode_vigilante in forum Adapter SDKs
Replies: 16
Last Post: January 27th, 2012, 03:58 PM
-
By usama in forum Client SDKs
Replies: 2
Last Post: March 19th, 2010, 10:03 AM
-
By devidasan in forum Adapter SDKs
Replies: 1
Last Post: March 17th, 2009, 11:00 AM
-
By hungn in forum Adapter SDKs
Replies: 2
Last Post: August 23rd, 2007, 09:21 AM
-
By Sinead in forum Adapter SDKs
Replies: 4
Last Post: February 14th, 2007, 03:47 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 04:02 PM.
Bookmarks