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.
-
Method Summary
Modifier and TypeMethodDescriptionGets theCachedMessageFactory
used to create the messages that are published via thisPublisher
.void
Publishes the data for a subject to peers that have just requested (subscribed to) that subject.void
publishSubjectErrorEvent
(SubjectErrorEvent subjectErrorEvent) Publishes to all peers subscribed to a subject an event detailing an error in the subscription for that subject.void
publishSubjectStatusEvent
(SubjectStatusEvent subjectStatusEvent) Publishes to all subscribed peers an event about the change in status of a subject.
-
Method Details
-
getCachedMessageFactory
CachedMessageFactory getCachedMessageFactory()Gets theCachedMessageFactory
used 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, aCachingDataProvider
will 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.
-