-
January 10th, 2011, 09:06 AM
#1
As far as I am concerned, I can only provide some guidelines, not the actual code.
First of all, the "data" database table should be extended with a third column, which should be declared as a unique key. As you recalled the StockList Demo, let's call it "stock_name".
Then your client page, in its extended form with two rows, should associate two item names to the two rows. In place of the "greetings" item name, you could use two stock names, for instance GOOG and MSFT.
You should then populate the table with data, using "GOOG" and "MSFT" as "stock_name" and setting suitable text in the "message" column.
You can even setup a process which changes the values in the "message" column over time.
Then the implementation of the Data Adapter should be extended in such a way that two possible threads can be spawned, depending on the item that is being subscribed to:
The two different threads will differ in the way they perform the query:
vs
Obviously, the above is the worst possible way in which you can generalize the code to two or more items,
but doing that in a better way is just a refactoring matter.
-
January 10th, 2011, 05:46 PM
#2
Thanks but...
your suggestion is the first thing that i thought of but as you said it's not the best way.
If it was just going to be the two it would be fine. But i'm sure it's going to extend through a loop.
In the stocklist example i see a syncronize(SubscribedItems) function.
I do understand what your talking about with the index key. I develop php web apps using mysql so the unique key concept is not a new one to me.
I think all i need is to know how to make the subscribed items based on those keys loop through and subscribe.
Can i pay someone to actually do this code?
If i can't find a solution I will have to look at a different product which is disappointing because i'm sure lightstreamer is more than capable of doing what we want
It seems like it would be really easy for someone with just a little bit of experience.
Thank you very much for your help i'll continue trying to make it work.
-
January 11th, 2011, 09:20 AM
#3
Let me add a few Lightstreamer-related notes.
If your aim is to perform one single loop, fetching all the rows of the "data" table at regular times,
so that, upon each row found, you can update the corresponding subscription (i.e. the item which corresponds with the row key),
this is also feasible.
Just consider that, for each line found, you will have to check whether the corresponding item is currently subscribed to,
because only in this case can update or smartUpdate be invoked
(hence the need to synchronize on subscribedItems, i.e. the set of the active subscriptions).
Such a loop should be active anytime there is at least one active subscription; you may choose to start it at Data Adapter initialization and keep it always running.
Obviously, depending on the size of the table and the client activity, most of the loop operations may be redundant.
Also note that, as long as the contents of the table don't change for a key, the updates you send for that key are also redundant: the Server will recognize that nothing has changed and will just discard the update.
Similar Threads
-
By mode_vigilante in forum Adapter SDKs
Replies: 16
Last Post: January 27th, 2012, 03:58 PM
-
By Mone in forum Client SDKs
Replies: 13
Last Post: September 9th, 2010, 05:51 PM
-
By Isanderthul in forum General
Replies: 1
Last Post: July 15th, 2009, 09:05 AM
-
By Sinead in forum Adapter SDKs
Replies: 4
Last Post: February 14th, 2007, 03:47 PM
-
By Alessandro in forum Client SDKs
Replies: 0
Last Post: November 24th, 2006, 03:49 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 03:30 PM.
Bookmarks