Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Jan 2007
    Location
    Dublin
    Posts
    5

    Database datafeed

    Hi,

    I am interested to know how I would handle the following situation. I want to use a database as the data feed. The table columns that is the source of the feed would nicely map to items requested by clients. The problem I have is that the query for the data would be differenct depending on the granularity that the client is interested in. For example one client is interested in having the data aggregated for a certain time period and another client is not interested in aggregating the data. What I'm tring to figure out is can I reuse the same data provider to make the different queries the actual datafeed will be much the same regardless but the results need to be directed to the particular client that is interested in a specific granularity only? I hope I'm clear!

    Thanks
    Sinead

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    Sinead,

    Could you please provide an example, showing a table schema, a couple of possible queries and corresponding data view on the front-end, so that we can better understand what you mean?

  3. #3
    Member
    Join Date
    Jan 2007
    Location
    Dublin
    Posts
    5
    Hi Alex,

    The following is a sample table
    PropertyName: Metric1: Metric2: Metric3: Timestamp:
    aProperty 10 100 15 12:59:00
    bProperty 5 3 0 12:59:00
    cProperty 9 444 2 12:59:00
    aProperty 11 36 55 12:59:01
    bProperty 54 33 25 12:59:02
    cProperty 123 23 14 12:59:03

    ClientX would request Propertya, Metric1 at a frequency of 1 second. In this case the dataprovider would query the database every second and the result would be a row of the table.
    ClientY would request Propertya, Metric2 at a frequency of 5 seconds. In this case the dataprovider would query the database every 5 seconds summing all the metrics in the last 5 seconds.

    I have one Adapter (so 1 dataProvider and 1 metdataProvider)
    This is where it gets a bit fuzzy for me so correct me if I'm wrong. As far as I know ClientX will subscribe to Propertya, Metric1 with a frequency of 1, Adapter1. This becomes a ClientX configuration in the metadataProvider.
    ClientY will subscribe to Propertya, Metric2 with a frequency of 5, Adapter1. This becomes a ClientY configuration in the metadataProvider.

    When the dataProvider receives a datafeed from the 1 second poll. How would it know whether this feed is for ClientX or ClientY. Seems that the key is the frequency but the frequency is known to the metadataAdapter can I use this in some way in the dataProvider so that this feed will finally get delivered to ClientX only?

    The other alternative I see is to let Lightstreamer deal with the frequency so the poll would be every second for all clients but the summation would be done by Lightstreamer but I'm not too sure if this would be possible.


    I hope this is somewhat clearer! Thanks for your help.
    Sinead

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    Hi Sinead

    Lightstreamer can perform a frequency filter on the updates for each item, but it does not perform any "summing" on field values; it just performs merging of changed and unchanged fields. You can take advantage of Lightstreamer frequency filter in your scenario only if you can feed it with cumulative metric values (to be computed by summing the metrics in the Data Adapter) and subtract the old cumulated values from the new ones on the client side.

    If you find this unacceptable, you need to specialize your items.
    In fact, as an architectural constraint, the Data Adapter has no knowledge of the details of the client requests, but it only knows the "items", which can be requested by multiple clients with different options.
    You can define an item for "Propertya, Metric1 at a frequency of 1 second", one for "Propertya, Metric2 at a frequency of 5 seconds" and so on, choosing suitable names for them. Your Data Adapter should be able to recognize the different items, with their own characteristics, based on their names only, and feed them accordingly.
    However, this means that the Data Adapter should provide to Lightstreamer Server two distinct flows of events for the two items. It can perform only one database polling cycle in order to provide both flows, but this mechanism has to be entirely implemented in the Data Adapter code.

    Dario

  5. #5
    Member
    Join Date
    Jan 2007
    Location
    Dublin
    Posts
    5
    Thanks for your help Dario. Sinead.

 

 

Similar Threads

  1. Database Feed
    By mode_vigilante in forum Adapter SDKs
    Replies: 16
    Last Post: January 27th, 2012, 04:58 PM
  2. 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
  3. Replies: 3
    Last Post: May 14th, 2008, 11:01 AM
  4. the many concurrent connection to database.
    By hungn in forum Adapter SDKs
    Replies: 2
    Last Post: August 23rd, 2007, 10:21 AM
  5. Adapter Database Pulling
    By Excalibur in forum Adapter SDKs
    Replies: 4
    Last Post: October 3rd, 2006, 10:38 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:07 AM.