Package com.caplin.datasource.publisher
Interface CachingPublisher
public interface CachingPublisher
An instance of
CachingPublisher publishes messages to remote DataSource peers on behalf of a
CachingDataProvider. It also provides access to a CachedMessageFactory that creates the messages to
be published. Messages once published are internally cached, so requests from additional peers can be serviced
without further calls to the provider.
Important Note: Caching publishers cannot be used where multiple datasource adapters provide data for a single
subject ( since they send image data). Where data must be supplied by multiple datasource adapters the
ActivePublisher should be used.
-
Method Summary
Modifier and TypeMethodDescriptionGets theCachedMessageFactoryused to create the messages that are published via thisPublisher.voidPublishes the data for a subject to peers that have just requested (subscribed to) that subject.voidpublishSubjectErrorEvent(SubjectErrorEvent subjectErrorEvent) Publishes to all peers subscribed to a subject an event detailing an error in the subscription for that subject.voidpublishSubjectStatusEvent(SubjectStatusEvent subjectStatusEvent) Publishes to all subscribed peers an event about the change in status of a subject.
-
Method Details
-
getCachedMessageFactory
CachedMessageFactory getCachedMessageFactory()Gets theCachedMessageFactoryused to create the messages that are published via thisPublisher.- Returns:
- The message factory.
-
publish
Publishes the data for a subject to peers that have just requested (subscribed to) that subject.- Parameters:
message- The message.
-
publishSubjectErrorEvent
Publishes to all peers subscribed to a subject an event detailing an error in the subscription for that subject. Typically, aCachingDataProviderwill use this to notify the remote peers that the data they are subscribed to is no longer available.- Parameters:
subjectErrorEvent- The error event to be published.
-
publishSubjectStatusEvent
Publishes to all subscribed peers an event about the change in status of a subject.- Parameters:
subjectStatusEvent- The subject status event to be published.
-