Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Member
    Join Date
    Jul 2009
    Location
    London
    Posts
    14

    Question Subscribing to the Table

    To subscribe to the table "Table 1" we are calling LSClient.SubscribeTable() passing ExtendedTableInfo. Constructor of ExtendedTableInfo does not accept table name, it accepts an array of item names. If we pass an array with one item and put a table name into it we can get all the items in the table. Is this the right thing to do (the constructor of ExtendedTableInfo is accepting a list of table names) or is the picture in page 5 of General Concepts.pdf is incorrect? In any case why does ExtendedTableInfo constructor accept an array of items?

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    With reference to the picture in General Concepts.pdf, a data table is characterized by a list of Item names or, alternatively, by a "Group" name.
    The two alternatives are reflected by the overloads of LSClient.SubscribeTable():
    • If you supply a SimpleTableInfo instance, you are describing the table through a Group name; the Metadata Adapter will expand the name into a list of items in getItems.
    • If you supply an ExtendedTableInfo instance, you are describing the table through a list of Item names; the Metadata Adapter will still receive a call to getItems and in this case it will receive the space-separated join of the Item names and it will be supposed to extract the Item names from the bundle, as the LiteralBasedProvider does.

    Note that the name of the data table ("Table1" in the picture) is not used by the Server, hence LSClient.SubscribeTable() does not require you to specify one.

    Your claim that
    If we pass an array with one item and put a table name into it we can get all the items in the table
    does not fit into the above description and should be clarified.

  3. #3
    Member
    Join Date
    Jul 2009
    Location
    London
    Posts
    14
    Thank you for the prompt response.

    In our case we need to subscribe to the whole table. We don't know the list of items at the time of subscription. We are subsribing in a COMMAND mode and are expecting to receive a snapshot i.e. a list of items.
    Should we use the SimpleTableInfo for this?
    Does a group always contain all items in a table, or can it be a subset?

    Presumably, in the method OnUpdate from an IHandyTableListener the itemName parameter is a unique name for an item within the table (as in "Item 1" in the diagramme on page 5). How is this different from the "key" field used in command mode?

    Currently we are passing what we thought was the table name into the ExtendedTableInfo as an item in an array of one element (we are specifying the fields in the Update method of an IItemEventListener on the server side within the itemEvent dictionary and are passing what we thought was the table name as the itemName in this method call). This is in command mode using distinct keys in the key field. This seems to work as we thought; we recieve a list of items (single items in quick succession) on snapshot and updates for seperate items as they are updated.

    Many thanks.

  4. #4
    Member
    Join Date
    Jul 2009
    Location
    London
    Posts
    14
    Having investigated our current code it looks like our table contains a single item. This is replaced each time with any new update. This results in the correct data appearing on the front end, but is obviously suspect (and we will need to reimplement). Does this sound like what could be happening?

    1. Does MetadaAdapter have to know the list of items for the table and send them to the LS kernel when a client is subscribing using SimpleTableInfo?

    2.When a new item is created should the app server notify both DataAdapter (to actually send data with the add command) and MetadataAdapter (to relate it to the relevant groups when another subscription request is received)? When the DataAtapter is sending data and there are no subscriptions the warning message is being written to the log file.

    3. Are snapshots requested for one item or for the whole group?

    4. How do we notify the client of new items that need to be subscribed to i.e. expand the set contained within a group so that the client can issue a subscription request for those items?

  5. #5
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    If you use COMMAND mode, then your approach is now clear.
    We just need to agree on the names of the various concepts.

    We use the concepts of Group and Item list to define static tables with a fixed number of lines, each of which corresponds to an Item that is usually managed in MERGE mode.

    On the other hand, if you subscribe to an item in COMMAND mode, then the item values carry commands that say: "ADD, UPDATE or REMOVE a line based on a specified key".
    Hence, by subscribing to a single Item, the client can maintain a whole data table based on the updates received for that single item.
    So, if you use items in COMMAND mode, you will usually subscribe to a table that, from Lightstreamer point of view, only contains one Item (i.e. the Group associated to the table is made of only one item).
    When only one item is involved, it is not important whether you use a SimpleTableInfo or an ExtendedTableInfo; your Metadata Adapter will receive the item name and shoud pass it through to the kernel (note that the ExtendedTableInfo is to be preferred because it still simplifies the management of the fields).
    On the client listener, all updates are referred to the unique item involved, but, for each update, you can extract the value of the "key" field involved. Using a HandyTableListener is recommended.

    Please check whether your questions about groups are still needed in this scenario.

  6. #6
    Member
    Join Date
    Jul 2009
    Location
    London
    Posts
    14
    1. If we have a dynamic table we should subscribe as described in the initial question?

    2. If so it is not clear how the snapshot is working; will lightstreamer cache updated items and be able to send initial data to the client without calling a DataProvider? How will authorization work in this scenario?

    3. Having checked our current implementation in the debugger, our IUpdateInfo's GetOldValue() method gets the previous item's value, not the old value for the current item. Is this to be expected in command mode, or should we be receiving the old value for the current item?

  7. #7
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    about 1) If you use an item in COMMAND mode (i.e. a dynamic table), then it is correct that you use an ExtendedTableInfo and supply a list made of a single name,
    which is the name of the item in COMMAND mode in Lightstreamer terms
    and the name of the table in you view.
    The picture in General Concepts.pdf only refers to the basic case of fixed tables and does not apply to this case. You should not refer to it; we will consider clarifying its context.

    about 2) Yes; if a client requests an item in COMMAND mode and other clients are already using it, then Lightstreamer does not ask for it again to the Data Adapter.
    It can provide a snapshot to the new client based on its own caching of the updates.
    The authorization is still performed at item level: if the new client is allowed by the Metadata Adapter to use the item, it will receive all its data.
    If this is not your case and different users should only see subsets of the whole dynamic table, this complicates matters.

    about 3) For an item in COMMAND mode, in Lightstreamer terms, all updates pertain to that same item, but each update is implicitly referred to a key value (which is the value of the mandatory "key" field) which identifies the row within the dynamic table.
    That said, it is not clear to me what you mean by "item" in your question.
    Note that, for an item in COMMAND mode, IUpdateInfo.GetOldValue yields the value on the previous update referred to the same key as the current update.
    In other words, it yields the previous value for the row of the dynamic table to which the current update refers.

  8. #8
    Member
    Join Date
    Jul 2009
    Location
    London
    Posts
    14
    Thank you, Dario.

    What would you recommend doing when subscribing in MERGE mode if we would like to infrequently add or remove items from the table?

    We have a situation where many clients will want overlapping, but not the same data from a set. As such we want to avoid COMMAND mode for this case as it would lead to a large number of disparate tables that contain data that could be (and would be in MERGE mode) shared. This set of data will occasionally have items added or removed, but this will be very infrequent when compared with the frequency of data updates.

    Would you advise unsubscribing from and resubscribing to the group when rows are added or removed?

  9. #9
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    Lists of items with many value updates and rare changes of the list contents are suitable for what we call two-level push.

    Unfortunately, the .NET client library offers no built-in support for two-level push, unlike other libraries. See the MultiDynaMetapush table in the web client library for instance. Would something similar fit into your case?
    You could implement the same logic in your client. In this way, you could provide multiple items in COMMAND mode for different list compositions without redundancies: data for each single line would by provided by a common, dedicated item in MERGE mode.

    On the other hand, unsubscribing and resubscribing to the whole group has some disadvantages.
    It would be inefficient, because each row would be restarted with a new snapshot (and your table should manage to mask the discontinuity).
    Moreover, you would still need asynchronous notifications that the group contents have changed, leading to something similar to the above mentioned "MultiMetapush" technique.

  10. #10
    Member
    Join Date
    Jul 2009
    Location
    London
    Posts
    14
    When subscribing with a SimpleTableInfo in MERGE mode, is there a way on the client to get the number of items, or at least get the end of snapshot event for the whole table?

 

 

Similar Threads

  1. Subscribing to multiple items
    By ablock in forum Client SDKs
    Replies: 1
    Last Post: May 2nd, 2012, 01:56 PM
  2. LS table how it works
    By betasec in forum Client SDKs
    Replies: 1
    Last Post: February 21st, 2011, 11:03 AM
  3. Problem re-subscribing
    By colmfield in forum Client SDKs
    Replies: 5
    Last Post: July 13th, 2010, 03:37 PM
  4. Update Table
    By EWANG in forum Client SDKs
    Replies: 1
    Last Post: August 19th, 2009, 11:17 AM
  5. having problem while subscribing pairs
    By rekhender in forum Adapter SDKs
    Replies: 1
    Last Post: October 31st, 2008, 10:58 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 09:23 AM.