Results 1 to 10 of 15

Hybrid View

  1. #1
    Hi,

    Regarding order of events we get:
    1) onSubscription
    2) onEndOfSnapshot
    3) onItemUpdate (ADD)

    After we return the initial set items in snapshot, we have a new Item that we want to listen.
    We added it by:
    _listener.Add(itemName, GetCurrentValues(true), false);

    As soon as we changed it to:
    _listener.Add(itemName, GetCurrentValues(true), true);

    everything is OK.

    Best regards,
    Slavko



  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Slavko,

    Please can you confirm that the third parameter of this method



    is the isSnapshot flag?

    If this is the case, please note that it must be set to "true" only for the updates needed to realign the current state of the Item, following a Subscribe request by the Lightstreamer server, but never after the call of the EndOfSnapshot method for that Item.

    Regards,
    Giuseppe

  3. #3
    Yes, third parameter is "isSnapshot".
    Let us talk about cities in the region.

    We want population of cities per region, so we subscribe:
    new Subscription("COMMAND", "Abbruzzo", cellList);


    At server we return the Snapshot


    update.Add("command", "ADD");
    _listener.OnEvent(Abbruzzo, Aquila, true);
    _listener.OnEvent(Abbruzzo, Lanciano, true);
    _listener.OnEndSnapshot(Abbruzzo);

    and we modify the items, without any problem.
    update.Add("command", "UPDATE");
    _listener.OnEvent(Abbruzzo, Aquila, false);


    But, when you build a new city in Abbruzzo , fer example Filetto, we did:


    update.Add("command", "ADD");
    _listener.OnEvent(Abbruzzo, Filetto, false);

    we get the problem with order of the events at the client.


    As soon as we changed it to:
    update.Add("command", "ADD");
    _listener.OnEvent(Abbruzzo, Filetto, true);

    everything is ok.


    Regards !

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Slavko,

    I'm sorry but I'm a bit confused about the behavior that you expect.

    Please, let me consider the sequence from the point of view of the client:
    1. Subscribes to the "Abbruzzo" Item in COMMAND mode;
    2. receives onSubscription event;
    3. receives onItemUpdate (ADD) events for the city of Aquila and Lanciano (isSnapshot return true);
    4. receives the onEndOfSnapshot event;
    5. receives several onItemUpdate (UPDATE) events for the changes in population count for the city of Aquila and Lanciano (isSnapshot return false);
    6. receives an onItemUpdate (ADD) event for the new city of Filetto (isSnapshot return false);
    7. receives several onItemUpdate (UPDATE) events for the changes in population count for the city of Aquila, Lanciano and Filetto (isSnapshot return false);

    Do you expect something different in the sequence above?

  5. #5
    Yes, it is expected and it is ok.
    I just wanted to show you what caused the problem of order of events at client.

    - new Subscription("COMMAND", "Abbruzzo", cellList);
    - we return Snapshot.
    - _listener.OnEndSnapshot(Abbruzzo);
    - we updates ...

    we added update.Add("command", "ADD");
    _listener.OnEvent(Abbruzzo, Filetto, false); // FALSE is WRONG !!!

    - we refresh the browser.
    - we get wrong order of events !

    But after we set:
    _listener.OnEvent(Abbruzzo, Filetto, true);

    everything is ok !

    regards!

  6. #6
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Slavko,

    If this solution works in your application then it's fine.

    Maybe I did not understand how this instruction



    exactly apply in your code.

    I understood that with that statement you're pushing, from the adapter to the server, an event of command type ADD with the snapshot flag set to true; but may be that I'm wrong.
    By the way, in that case you should have a warning message like this

    "Unexpected snapshot event for COMMAND item ..."

    in the log server.

  7. #7
    I did some investigation of log, and i have no warning messages like these
    "Unexpected snapshot event for COMMAND item ..."


    Before i do more investigation, i would like know your suggestion for the case.


    - We start the LS
    - User opens the browser after a few seconds aftre, asking for Snapshot,
    new Subscription("COMMAND", "Abbruzzo", cellList);

    - We return 2 cities as the Snapshot.
    update.Add("command", "ADD");
    _listener.OnEvent(Abbruzzo, update(Aquila), true);


    update.Add("command", "ADD");
    _listener.OnEvent(Abbruzzo, update(Lanciano), true);

    _listener.OnEndSnapshot(Abbruzzo);


    - After that we get notified that a new city is built and we send:
    update.Add("command", "ADD");
    _listener.OnEvent(Abbruzzo, Filetto, true);


    - User does browser refresh
    - User have all the cities in Snapshot and right order of events.


    In case of returning the new city Lanciano like this:
    update.Add("command", "ADD");
    _listener.OnEvent(Abbruzzo, update(Lanciano), false);
    user gets wrong order of events after browser refresh.
    It seems only the first time, after browser Refresh.


    regards!
    Last edited by Slavko Parezanin; February 24th, 2014 at 02:14 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 12:40 PM.