just_opposite
Hi,
Is there a way to allow snapshot data to expire. The use case here is that assuming our data source had an issue and had pushed bad data to LS server, now this data source is external to our organization/division. We would like the LS server to drop bad data after certain timeout so to avoid a LS server bounce.
Thanks
Edward
marco.testa
Hi Edward,
Currently there is not such a function like a snapshot expiration, but it will be introduced in the next upcoming Lightstreamer release, expected for the first months of next year.
For now you can use a workaround depending on the management mode. For instance, in MERGE mode the adapter may send an ItemEvent with blank field, overriding the Item state containing bad data.
In COMMAND mode the adapter may send an UPDATE or even a DELETE, removing the key from the snapshot.
For DISTINCT mode the workaround is actually more cumbersome since the only way to remove an ItemEvent from the snapshot is to add new ItemEvents until the bad ItemEvent is dropped from the snapshot buffer.
hth,
Marco
just_opposite
Marco,
Can you please clarify what do you mean by sending an ItemEven with "blank" field. I've try calling ItemEventListener.update with a newly created item (with the same item name as the item that I'd like to force an expiration on the snapshot) where the values hashmap contains Key Value pairs where the individual values are "" empty string. This method removes "bad" data from the snapshot but it also sends updates to clients as well, which in our scenario is not desirable. I've also try update call with an item where the values hashmap contains zero pairs.
Thanks
Edward
marco.testa
Hi Edward,
As I said, it's just a workaround, so, yes, in order to override the filed values of an item state in the snapshot, the Data Adapter may send an ItemEvent with empty strings for the expired fields to the Lightstreamer Kernel, but the server will broadcast an ItemUpdate to all subscribed clients.
The idea behind is that a snapshot represent the state of an Item as it is represented on all subscribed clients at a certain time. So, if a new client subscribes to an Item and receives the snapshot, its state is the same as all the other already subscribed clients.
If I correctly understand, your requirement is to have instead the expired values removed only from the snapshot, so for clients which will subscribe from now on, but not on the already subscribed ones.
Since the requirements for expiration policies may vary and depends on the problem domain, this is something that should be implemented by your application.
If your data are managed in MERGE mode (am I correct?), you can for instance use a specific string to represent blank values for expired fields, so that a client may consider the value as actually blank, if it has been received as a snapshot, or ignore it, and keep the previous received value, if it has been received in a normal item update, while actual blank fields will be treated consistently on all clients.
hth
Marco