DataSource.NET
7.1.2.311419
|
This implementation of IPublisher uses the DataSource.NET data cache so that the IDataProvider implementation does not have to directly manipulate the data in IMessages. More...
Additional Inherited Members | |
Public Member Functions inherited from Caplin.DataSource.Publisher.IPublisher | |
void | PublishInitialMessage (IMessage message) |
Publishes the initial message of the data for a Subject to peers that have just requested (subscribed to) that subject. More... | |
void | PublishMappingMessage (IMappingMessage mapping) |
Publishes to all peers subscribed to a subject a message that instructs the remote peer to request an alternate subject in order to satisfy the subscription. More... | |
void | PublishStatusEvent (IStatusEvent ev, string subject) |
Publishes to all subscribed peers an event about the change in status of a subject. More... | |
void | PublishSubjectErrorEvent (ISubjectErrorEvent ev) |
Publishes to all peers subscribed to a subject an event detailing an error in the subscription for that subject. Typically an IDataProvider will use this to notify the remote peers that an string they are subscribed to is no longer available. More... | |
void | PublishSubjectStatusEvent (ISubjectStatusEvent ev) |
Publishes to all subscribed peers an event about the change in status of a subject. More... | |
void | PublishToSubscribedPeers (IMessage message) |
Publishes a message to subscribed peers (that is, the peers that have already received an initial image). More... | |
Properties inherited from Caplin.DataSource.Publisher.IPublisher | |
IMessageFactory | MessageFactory [get] |
Gets the IMessageFactory used to create the messages that are published via this publisher. More... | |
This implementation of IPublisher uses the DataSource.NET data cache so that the IDataProvider implementation does not have to directly manipulate the data in IMessages.
This implementation of IPublisher is particularly useful when for dealing with complex DataSource data types, such as Container objects.
An ICachedPublisher passes just the initial subscription request and the final discard from DataSource peers to the IDataProvider. Requests from other peers following the initial request are satisfied by the DataSource.NET cache. This means that the IDataProvider implementation will only receive a single request and a single discard, and it does not need to keep track of the number of requests and discards that the DataSource application has received.
To satisfy subscription requests, the ICachedPublisher queries the ICacheManager for the initial message data and all subsequent update messages. For this to work properly:
Typically the IDataProvider may also wish to delete the cache entry when the data providing entity reports that the data for that string is no longer available. In such a case it is commonly desirable to send an Caplin.DataSource.ISubjectErrorEvent with a SubjectError field set to DeleteObject to inform subscribed peers that the data has been removed from the system.
The following is a simple example of an IDataProvider written for a CachedPublisher. Similar implementations of IDataProvider can be used with the SimplePublisher with the caveat that request/discard counting would be required.