-
August 25th, 2014, 11:58 AM
#1
Null Values in OnUpdate
Dears,
we are using this code to subscribe from lightstreamer
var tableInfo = new SimpleTableInfo("sy1 sy2 sy3 sy4 sy5", "MERGE",
"adjustedYestClose AskPrice AskVol AvaragePrice"
, true) {DataAdapter = "PROXY_MarketBeat"};
_subKey = Tabee3Client.client.SubscribeTable(tableInfo, this, false);
the lightstreamer returns 2 snapshot the first snapshot have null values in all items in (IUpdateInfo collection) after i ends the lightstreamer send the second snapshot with the values.
what is the problem and how to solve it?
Regards,
-
August 26th, 2014, 09:35 AM
#2
Hi,
I suspect that in your adapter you declare you have a snapshot in the isSnapshotAvailable method and then you send the first update with the snapshot flag set to false. This will cause the server to consider the snapshot to be made of empty values and thus it will send nulls. After that it sends the first update of your adapter.
Can you please check?
-
September 15th, 2014, 03:42 PM
#3
Dears,
I have set
public bool IsSnapshotAvailable(string itemName)
{
return true;
}
and this on the sending data to lightstreamer
_listener.Update("hp" + index.ToString(), eventData, false);
but it still sending null values in the onupdate method
Regards,
-
September 16th, 2014, 10:17 AM
#4
Yes exactly, you specify true in your IsSnapshotAvailable implementation.
Then you send the update telling the server that what you're sending is not the snapshot:
_listener.Update("hp" + index.ToString(), eventData, false);
thus the server creates a snapshot of null values for you and after that sends your update.
You might either returning false in the IsSnapshotAvailable implementation or set the snapshot flag to true when sending the first update: either case you'll get rid of the null upates.
HTH
-
September 16th, 2014, 03:07 PM
#5
Dears,
i try all possible values of IsSnapshotAvailable and _listener.Update
1- true - true
2- false - false
3- true - false
4- false - true
the 1&2 cases not return null and also not return the snapshot.
the 3&4 cases return null on first update from lightstreamer.
what i need is to get the snapshot data on first update
Regards
-
September 17th, 2014, 09:17 AM
#6
Case 1 should return the snapshot, case 4 should not return the nulls, can you please double-ceck?
In any case you can't use a fixed value in the update call:
you have to return true in the IsSnapshotAvailable and then you have to use true on the first Update call following the subscription of the related item, and use false for every subsequent call until you get the unsubscription for the item. If there is a new subscription call you will repeat the same: true on the first Update false on the subsequent ones
This demo does that: https://github.com/Weswit/Lightstrea...dapter-dotnet/
https://github.com/Weswit/Lightstrea...ockList.cs#L62
https://github.com/Weswit/Lightstrea...ckList.cs#L102
-
September 17th, 2014, 03:03 PM
#7
thanks for reply but i try that and result is null or no data on the onupdate()
i will illustrate my case it may differ and give you example of what happened.
my adapter sends the updates to the lightstreamer only one time at 3.30 pm then the client open the application at 4.00 pm and subscribe for the items.
if the client opened the app at 3.30 or befor, the data returned.
but in my case and when i use true and false cases, data returned null or no data.
i need if the adapter sends the data only one time to the lightstreamer and then in any after time the client opens the app and subscribe, he can get data correctly.
-
September 18th, 2014, 09:49 AM
#8
Hi,
Lightstreamer does not keep the snapshot while no client is subscribed. In your server log you should see the "Unexpected update" message(s) when you issue an update and there are no clients.
Your adapter should be able to retrieve and send the snapshot when the subscribe method is called (that is the first client is connected). After that the server will handle the snapshot for other clients subscribing to the same item.
Another, less reliable, option is to keep a fake client always subscribed to your item. You might code it directly into your adapter.
In any case please take a look to the General Concepts file (section 4), it will probably clear things up for you: http://www.lightstreamer.com/latest/...20Concepts.pdf
Similar Threads
-
By darch in forum Client SDKs
Replies: 0
Last Post: March 14th, 2013, 02:59 PM
-
By finodex in forum Client SDKs
Replies: 3
Last Post: September 10th, 2012, 09:47 AM
-
By hofmanna in forum Client SDKs
Replies: 5
Last Post: January 14th, 2010, 10:02 AM
-
By Otake in forum Client SDKs
Replies: 2
Last Post: December 17th, 2009, 02:13 PM
-
By rsouissi in forum Client SDKs
Replies: 4
Last Post: March 6th, 2008, 01:59 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 07:05 AM.
Bookmarks