Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Dec 2014
    Location
    Madinah, Sudia Arabia
    Posts
    17

    Command Subscribe Issue

    Dear Support team,

    I created a command mode Subscribe to some data in light streamer.
    the commands considered to be add, update and delete. the command and data are received, and displayed successfully in the client side.

    the issue occurs when opening the form that contains the data and let it opened, then disconnecting light streamer and reconnecting again then the data in the form updated to a wrong data items and duplicated.

    could you provide me with best way to use command mode subscription to prevent data errors and duplication in my case?

    Note: I send snap bool as "true" while building sample table info as the following code sample:

    "
    Code:
     var tableInfoData = new SimpleTableInfo("prefix" + _stoks, "COMMAND", "command key field1 field2", true) {DataAdapter = "mainAdapter"};
    "

    if I invoked delete command while snap is true, does data exists and could be retrieved in next update?
    Thanks and Best regards,
    Hassan A. Shehata

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    541
    Hi Hassan,

    From the client point of view the snapshot in case of COMMAND mode consists exclusively of ADD events.
    Thus when a .NET client reconnects (after a disconnection) it should worry about to recover the consistency of the data displayed upon the new snapshot received.
    The easiest way to do this is:
    - clean all the old data in the view. The moment most suitable to do this depends according to the needs of your application; in fact you can do it right away detected the disconnection or let the user see the old data until the new subscription succeded.
    - add from scratch the keys included in the new snapshot.

    Furthermore, consider that the key field for an Item is unique and therefore you can protect your data view by adding a check for this.

    From the Lightstreamer server point of view, if it receives a DELETE events even with snapshot flag to true, this delete actually the key from the Item if any. The next UPDATE event for that key will be converted automatically in a ADD event. But maybe I did not understand what you mean.

    Regards,
    Giuseppe

  3. #3
    Member
    Join Date
    Dec 2014
    Location
    Madinah, Sudia Arabia
    Posts
    17
    Dear Giuseppe,

    There are delete and update commands received, actually issue occurred in case of the command received is a delete command.
    so I need to understand the behavior of subscription in case delete command and snap is true.
    Thanks and Best regards,
    Hassan A. Shehata

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    541
    Hi Hassan,

    I am assuming that for "snap is true" you mean an update sent by your adapter to the Lightstreamer server with isSnapshot flag set to true (please correct me if I'm wrong).

    Please, consider that the isSnapshot value apply only in the immediate aftermath of the subscribe call of your adapter for the Item. After the EndOfSnapshot is called or an update is received with isSnapshot to false, the isSnapshot value it is irrelevant.

    Generally a DELETE command involves removing the specified key, if any, from the logical model of the Item.
    Actions towards clients can be different: the DELETE command can be sent to the client or if the ADD event for the same key is not out yet, the two events are merged and nothing sent to the client.

    When a DELETE command is received with isSnapshot flag set to true a warning message is logged by the server since a DELETE command is not expected as snapshot, however the command is handled:
    - if the key is already present, as described above.
    - esle is simply discarded.

    Regards,
    Giuseppe

 

 

Similar Threads

  1. problem in command subscribe
    By engcoder in forum Client APIs
    Replies: 7
    Last Post: January 27th, 2016, 06:27 PM
  2. Client validation inside subscribe call
    By antiGuru in forum Adapter APIs
    Replies: 1
    Last Post: February 5th, 2010, 10:55 AM
  3. dynamically subscribe items
    By rd2008 in forum General
    Replies: 9
    Last Post: October 10th, 2008, 11:38 AM
  4. subscribe to items not using threads
    By nagakumaran in forum Adapter APIs
    Replies: 6
    Last Post: October 16th, 2007, 03:11 PM
  5. Data Adapter's subscribe() method not getting called
    By CitiMan in forum Adapter APIs
    Replies: 8
    Last Post: November 30th, 2006, 05:26 PM

Tags for this Thread

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 03:13 AM.