DataSource.NET  6.2.20.310828
Caplin.DataSource.Publisher.IPublisher Interface Reference

An instance of IPublisher publishes messages to remote DataSource peers on behalf of an IDataProvider. It also provides access to an IMessageFactory that creates the messages to be published. More...

Inheritance diagram for Caplin.DataSource.Publisher.IPublisher:
Caplin.DataSource.Publisher.IActivePublisher Caplin.DataSource.Publisher.IBroadcastPublisher Caplin.DataSource.Publisher.ICompatibilityPublisher

Public Member Functions

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 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

IMessageFactory MessageFactory [get]
 Gets the IMessageFactory used to create the messages that are published via this publisher. More...
 

Detailed Description

An instance of IPublisher publishes messages to remote DataSource peers on behalf of an IDataProvider. It also provides access to an IMessageFactory that creates the messages to be published.

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 Caplin.DataSource.DataSource.CreateActivePublisher method of the DataSource. An Caplin.DataSource.Namespace.INamespace is provided so that the created IPublisher knows which strings it must service.

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());
}
}
}

Member Function Documentation

void Caplin.DataSource.Publisher.IPublisher.PublishInitialMessage ( IMessage  message)

Publishes the initial message of the data for a Subject to peers that have just requested (subscribed to) that subject.

Parameters
messageThe message to be published.
void Caplin.DataSource.Publisher.IPublisher.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.

Parameters
mappingThe IMappingMesssage to be published.

Publishing a mapping message satisfies the "initial message" requirement.

void Caplin.DataSource.Publisher.IPublisher.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.

Parameters
evThe ISubjectErrorEvent to be published.
void Caplin.DataSource.Publisher.IPublisher.PublishSubjectStatusEvent ( ISubjectStatusEvent  ev)

Publishes to all subscribed peers an event about the change in status of a subject.

Parameters
evThe subject status event to be published.
void Caplin.DataSource.Publisher.IPublisher.PublishToSubscribedPeers ( IMessage  message)

Publishes a message to subscribed peers (that is, the peers that have already received an initial image).

Parameters
messageThe message to be published. This may be an image or an update.

Property Documentation

IMessageFactory Caplin.DataSource.Publisher.IPublisher.MessageFactory
get

Gets the IMessageFactory used to create the messages that are published via this publisher.

The message factory.


Generated on Wed Jan 24 2018 12:22:40 for DataSource.NET