Results 1 to 10 of 11

Hybrid View

  1. #1
    Member
    Join Date
    Jul 2009
    Location
    San Francisco
    Posts
    9

    Table.onEndOfSnapshot not being called

    I'm trying to get Table.onEndOfSnapshot to be called once a snapshot has been sent. In the Portfolio demo that comes with Lightstreamer (pages/demos/PortfolioDemo/portfolio.js), I inserted the following line:

    Code:
    table.setDataAdapter("PORTFOLIO_ADAPTER"); // first-level Data Adapter
    table.setUnderDataAdapter("QUOTE_ADAPTER"); // second-level Data Adapter
    table.setSnapshotRequired(true);
    table.setPushedHtmlEnabled(false);
    table.onEndOfSnapshot = function(itemPos, itemName) {
    	alert('end of snapshot');
    };
    I was expecting to get an alert when the snapshot was sent. But nothing happens.

    In the server's log file, I do see this:
    Code:
    portfolio1: snapshot sent
    which is sent by the PortfolioDataAdapter Java class, right after it calls listener.smartEndOfSnapshot().

    Does anyone know why onEndOfSnapshot isn't being called?

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,091
    A bug affecting snapshots was fixed on the portfolio demo Data Adapter about one year ago
    and released with Server version 3.5 build 1422.
    Is it possible that you are using an older version?
    Before the fix, the EndOfSnapshot signal were issued only upon the first real-time update of the portfolio composition.

  3. #3
    Member
    Join Date
    Jul 2009
    Location
    San Francisco
    Posts
    9
    I have Moderato version 3.5 build 1428.4. I just downloaded it about a week ago. The following behavior happens pretty consistently:

    1. Start the server.
    2. Load the Portfolio Demo. No alert appears. The page starts receiving real-time updates.
    3. Submit an "order" for any quantity of any stock.
    4. The alert appears, right after I submit the order.
    5. Reload the page. This time the alert appears immediately after the data loads, as it should.

    Thanks,
    Jacob

  4. #4
    Member
    Join Date
    Jul 2009
    Location
    San Francisco
    Posts
    9
    I should also add that I first noticed this behavior with my own metadata/data adapters. So it's not limited to just the Portfolio demo.

  5. #5
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,091
    I have found an error in our distribution process,
    so the predeployed portfolio demo jars were not updated after the abovementioned fix.
    However, the copies of the same jars under
    DOCS-SDKs\sdk_adapter_java\examples\Portfolio_Adapters\ Deployment_LS\Portfolio\lib
    did get updated.
    Hence, you can refresh the two jars in adapters\Demo\portfolio\lib with the corresponding ones under the DOCS-SDKs tree.

  6. #6
    Member
    Join Date
    Jul 2009
    Location
    San Francisco
    Posts
    9
    Thanks! That did the trick. And to correct my last post, this wasn't happening with my own adapters; I was just using the Portfolio adapters with my own JavaScript. So problem solved.

  7. #7
    Member
    Join Date
    Jul 2009
    Location
    San Francisco
    Posts
    9
    One more question on this topic. That onEndOfSnapshot function gets called when the main table's snapshot is finished, which is when all rows have been added to the table. But at that point, the rows are mostly empty.

    As I understand it, each row gets its own subscription, and its own snapshot. So after onEndOfSnapshot is called, you'll get an update for each row, with a CHANGE command, and itemUpdate.isSnapshot set to true.

    What's the best way to detect when all of those snapshots have been received? I'd like to know when the table is fully populated with data, not just when it has the names of all the row items. I can think of two ways:

    1) Look for the first update where isSnapshot is false. This seems to only happen after all of the rows' snapshots have been received, but I'm not sure whether that's guaranteed to be the case. Also, this means you have to wait for the first non-snapshot update before you can know that the snapshot is done.

    2) Count the number of rows that were ADDed, and wait until you get an UPDATE with isSnapshot=true for each one. This seems more reliable, although it involves more work on the client side.

    Or is there a way to listen for the onEndOfSnapshot for each individual row's table?

    Thanks,
    Jacob

 

 

Similar Threads

  1. Subscribing to the Table
    By AidasOzelis in forum Client SDKs
    Replies: 13
    Last Post: June 3rd, 2010, 02:13 PM
  2. Error: createEngine() has already been called
    By vaduganathan in forum Client SDKs
    Replies: 3
    Last Post: April 9th, 2010, 09:58 AM
  3. notifySessionClose sometimes not being called
    By lstest in forum Adapter SDKs
    Replies: 2
    Last Post: February 24th, 2010, 12:09 PM
  4. Update Table
    By EWANG in forum Client SDKs
    Replies: 1
    Last Post: August 19th, 2009, 11:17 AM
  5. Data Adapter's subscribe() method not getting called
    By CitiMan in forum Adapter SDKs
    Replies: 8
    Last Post: November 30th, 2006, 05:26 PM

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 01:23 PM.