C# | Visual Basic | Visual C++ |
public interface IPublisher
Public Interface IPublisher
public interface class IPublisher
All Members | Methods | Properties | |||
Icon | Member | Description |
---|---|---|
MessageFactory |
Gets the IMessageFactory used to create the messages that are published via this publisher.
| |
PublishInitialMessage(IMessage) |
Publishes the initial message of the data for a Subject
to peers that have just requested (subscribed to) that subject.
| |
PublishMappingMessage(IMappingMessage) |
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.
| |
PublishSubjectErrorEvent(ISubjectErrorEvent) |
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.
| |
PublishSubjectStatusEvent(ISubjectStatusEvent) |
Publishes to all subscribed peers an event about the change in status of a subject.
| |
PublishToSubscribedPeers(IMessage) |
Publishes a message to subscribed peers (that is, the peers that have already received an initial image).
|
DataSource.NET includes several implementations of IPublisher that you can use in your DataSource application: see IBroadcastPublisher, IActivePublisher. To use one of these IPublishers call the appropriate "create publisher" method of DataSource: CreateBroadcastPublisher, or CreateActivePublisher.
These three child interfaces declare no methods further to those declared in IPublisher and currently only serve to tag each IPublisher type. However, it is possible that future versions of DataSource.NET may add publisher-type specific methods to these interfaces if deemed appropriate or useful.
The following example shows an IPublisher being created by calling the CreateActivePublisher(INamespace, IDataProvider) method of the DataSource. An INamespace is provided so that the created IPublisher knows which strings it must service.
using Caplin.DataSource; using Caplin.DataSource.Namespace; using Caplin.DataSource.Publisher; namespace DataSourceExamples.Publisher { public class CreateSimplePublisher { public static void CreateSimplePublisherExample(DataSource dataSource) { // Create a simple INamespace that matches subjects starting with "/FX". INamespace fxNamespace = new PrefixNamespace("/FX"); // Ask the DataSource to create a publisher that uses the fxNameSpace. IPublisher publisher = dataSource.CreateActivePublisher(fxNamespace, new MyDataProvider()); } } }