Lightstreamer .Net Adapter 1.7
ContentsIndexHome
PreviousUpNext
IDataProvider.Subscribe Method

Called by Lightstreamer Remote Server to request data for an Item. If the request succeeds, the Remote Data Adapter can start sending an ItemEvent to the listener for any update of the Item value. Before sending the updates, the Remote Data Adapter may optionally send one or more ItemEvents to supply the current Snapshot. 

The general rule to be followed for event dispatching is:

     if IsSnapshotAvailable(itemName) == true
          SNAP* [EOS] UPD*
     else
          UPD*

where: 

- SNAP represents an Update call with the isSnapshot flag set to true 

- EOS represents an EndOfSnapshot call 

- UPD represents an Update call with the isSnapshot flag set to false 

The composition of the snapshot depends on the Mode in which the item is to be processed. In particular, for MERGE mode, the snapshot consists of one event and the first part of the rule becomes:

          [SNAP] [EOS] UPD*

where a missing snapshot is considered as an empty snapshot. 

If an item can be requested only in RAW mode, then IsSnapshotAvailable should always return false; anyway, when an item is requested in RAW mode, any snapshot is discarded. 

Note that calling EndOfSnapshot is not mandatory; however, not calling it in DISTINCT or COMMAND mode may cause the server to keep the snapshot and forward it to the clients only after the first non-shapshot event has been received. The same happens for MERGE mode if neither the snapshot nor the EndOfSnapshot call are supplied. 

Unexpected snapshot events are converted to non-snapshot events (but for RAW mode, where they are ignored); unexpected EndOfSnapshot calls are ignored. 

The method can be blocking, but, as the Proxy Adapter implements subscribe and unsubscribe asynchronously, subsequent subscribe-unsubscribe-subscribe-unsubscribe requests can still be issued by Lightstreamer Server to the Proxy Adapter. When this happens, the requests may be queued on the Remote Adapter, hence some Subscribe calls may be delayed. 

 

C++
void Subscribe(string itemName);
C#
void Subscribe(string itemName);
Visual Basic
Function Subscribe(itemName As string) As void
Parameters 
Description 
string itemName 
Name of an Item. 
Exceptions 
Description 
in case the request cannot be satisfied.  
in case the method execution has caused a severe problem that can compromise future operation of the Data Adapter.