DataSource.NET
7.1.27.94946-7eb8eb54
|
Interface that must be implemented in order to provide data updates to DataSource peers. More...
Inherited by Caplin.DataSource.Channel.ChannelProvider.
Public Member Functions | |
void | ReceiveDiscard (IDiscardEvent discardEvent) |
Callback that informs the DataProvider that an earlier requested subject has now been discarded and it should stop sending data. More... | |
void | ReceiveRequest (IRequestEvent requestEvent) |
Callback that informs the DataProvider that a new request has been received and it should start sending data. More... | |
Interface that must be implemented in order to provide data updates to DataSource peers.
The example should a skeleton implementation of the IDataProvider interface. Typically, an IDataProvider implementation will require a reference to its IPublisher so it may emply that publisher for sending messages. In this example this is acheived by injecting the publisher into the IDataProvider via its constructor.
The IDataProvider methods are not called on a dedicated worker thread. Therefore, if any of these methods are likely take a relatively long time to execute, they should be coded to run in a separate thread.
void Caplin.DataSource.Publisher.IDataProvider.ReceiveDiscard | ( | IDiscardEvent | discardEvent | ) |
Callback that informs the DataProvider that an earlier requested subject has now been discarded and it should stop sending data.
discardEvent | The event that describes the discard (which peer and which subject). |
The action that an IDataProvider should take when ReceiveDiscard() is called depends on the type of Caplin.DataSource.Publisher.IPublisher that is being used by the DataSource application.
If the IPublisher is an Caplin.DataSource.Publisher.IActivePublisher the IDataProvider should maintain a record of the peers subscribing to each particular subject. When a peer discard the subject, the IDataProvider should delete the peer from its listm but continue to publish updates for the subject. When there are no more peers subscribing to the subject, the IDataProvider must stop publishing updates.
If the IPublisher is an Caplin.DataSource.Publisher.IBroadcastPublisher, ReceiveDiscard is never called.
void Caplin.DataSource.Publisher.IDataProvider.ReceiveRequest | ( | IRequestEvent | requestEvent | ) |
Callback that informs the DataProvider that a new request has been received and it should start sending data.
requestEvent | The event that describes the request (which peer and which subject). |
The action that an IDataProvider should take when ReceiveRequest() is called depends on the type of Caplin.DataSource.Publisher.IPublisher that is being used by the DataSource application.
If the IPublisher is an Caplin.DataSource.Publisher.IActivePublisher the IDataProvider should record the peer that has issued the request, and if it is the first request for the subject, it should start sending data. The list of subscribed peers is used to determine when the IDataProvider should stop sending data (see Caplin.DataSource.Publisher.IDataProvider.ReceiveDiscard.
If the IPublisher is an Caplin.DataSource.Publisher.IBroadcastPublisher, ReceiveRequest is never called.