DataSource.NET
8.0.3.290770-7760911e
|
This publisher implementation uses the DataSource.NET data cache so that the ICachingDataProvider implementation does not have to directly manipulate the data in IMessages. More...
Inherited by Caplin.DataSource.Publisher.CachingPublisher.
Public Member Functions | |
void | Publish (IMessage message) |
Publishes a message to subscribed peers. 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 ICachingDataProvider 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... | |
Properties | |
ICachedMessageFactory | CachedMessageFactory [get] |
Gets the IMessageFactory used to create the messages that are published via this publisher. More... | |
This publisher implementation uses the DataSource.NET data cache so that the ICachingDataProvider implementation does not have to directly manipulate the data in IMessages.
This publisher implementation is particularly useful when for dealing with complex DataSource data types, such as Container objects.
An ICachingPublisher passes just the initial subscription request and the final discard from DataSource peers to the ICachingDataProvider. Requests from other peers following the initial request are satisfied by the DataSource.NET cache. This means that the ICachingDataProvider 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 ICachingPublisher queries the ICacheManager for the initial message data and all subsequent update messages. For this to work properly:
Publish updates from the data providing entity using the Caplin.DataSource.Publisher.ICachingPublisher.Publish method. For all other requests that are handled by the ICachingPublisher for you, the ICachingPublisher will send out an initial image automatically using the cache.
Typically the ICachingDataProvider 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 ICachingDataProvider written for a CachingPublisher.
void Caplin.DataSource.Publisher.ICachingPublisher.Publish | ( | IMessage | message | ) |
Publishes a message to subscribed peers.
message | The message to be published. This may be an image or an update. |
void Caplin.DataSource.Publisher.ICachingPublisher.PublishSubjectErrorEvent | ( | ISubjectErrorEvent | ev | ) |
Publishes to all peers subscribed to a subject an event detailing an error in the subscription for that subject. Typically an ICachingDataProvider will use this to notify the remote peers that an string they are subscribed to is no longer available.
ev | The ISubjectErrorEvent to be published. |
void Caplin.DataSource.Publisher.ICachingPublisher.PublishSubjectStatusEvent | ( | ISubjectStatusEvent | ev | ) |
Publishes to all subscribed peers an event about the change in status of a subject.
ev | The subject status event to be published. |
|
get |
Gets the IMessageFactory used to create the messages that are published via this publisher.
The message factory.