DataSource.NET  7.1.29.112283-2b6ad187
Caplin.DataSource.Messaging.IMessageFactory Interface Reference

A message factory is used to create DataSource messages that can be published to other DataSources. More...

Inherited by Caplin.DataSource.Messaging.IInternalMessageFactory.

Public Member Functions

IContainerMessage CreateContainerMessage (string subject)
 Create a message that defines a container. The name of the container is the given subject. More...
 
IGenericMessage CreateGenericMessage (string subject)
 Creates a Generic message to which Generic structured data can be added. More...
 
IJsonMessage CreateJsonImageMessage (string subject, string json)
 Creates a JSON image message for the given subject. More...
 
IJsonMessage CreateJsonPatchMessage (string subject, string json)
 Creates a JSON patch message for the given subject. More...
 
IMappingMessage CreateMappingMessage (string subject, string mapping)
 Create a new mapping message; More...
 
INewsMessage CreateNewsMessage (string subject, string headline, string storyReference, string newsDateTime)
 Creates a News message for the given subject. More...
 
IPageMessage CreatePageMessage (string subject, int maxColumns, int maxRows)
 Creates a Page message for the given subject. More...
 
IPermissionMessage CreatePermissionMessage (string subject, string key)
 Creates a Permission message for the given subject. More...
 
IRecordType1Message CreateRecordType1Message (string subject)
 Creates a Record message to which Type 1 structured data can be added. More...
 
IRecordType2Message CreateRecordType2Message (string subject, string type2Indexfield, string type2IndexValue)
 Creates a Record message to which Type 2 structured data can be added. More...
 
IRecordType3Message CreateRecordType3Message (string subject)
 Creates a Record message to which Type 3 structured data can be added. More...
 
IStatusEvent CreateStatusEvent (SubjectStatus status, string message)
 Creates a status event. More...
 
IStoryMessage CreateStoryMessage (string subject, string text)
 Creates a story message for the given subject. More...
 
ISubjectErrorEvent CreateSubjectErrorEvent (string subject, SubjectError error, params SubjectErrorFlags[] flags)
 Creates a subject error event. More...
 
ISubjectStatusEvent CreateSubjectStatusEvent (string subject, SubjectStatus status, string message)
 Creates a subject status event. More...
 
IWrapperMessage CreateWrapperMessage (string subject)
 Create a new wrapper message; More...
 

Detailed Description

A message factory is used to create DataSource messages that can be published to other DataSources.

Member Function Documentation

IContainerMessage Caplin.DataSource.Messaging.IMessageFactory.CreateContainerMessage ( string  subject)

Create a message that defines a container. The name of the container is the given subject.

Parameters
subjectThe subject defining the name of the container.
Returns
A message defining the container.
IGenericMessage Caplin.DataSource.Messaging.IMessageFactory.CreateGenericMessage ( string  subject)

Creates a Generic message to which Generic structured data can be added.

Parameters
subjectThe subject of the Message.
Returns
A new Generic message.

Generic messages can be used without specifying field mappings in a separate adapter configuration file. This may be useful when receiving updates from a provider which supplies a variable or unknown number of fields.

The returned message contains no data. To populate the message with data, use the appropriate methods of Caplin.DataSource.Messaging.Record.IGenericMessage.

IJsonMessage Caplin.DataSource.Messaging.IMessageFactory.CreateJsonImageMessage ( string  subject,
string  json 
)

Creates a JSON image message for the given subject.

Parameters
subjectThe subject.
jsonThe JSON image string.
Returns
A new JSON message.
IJsonMessage Caplin.DataSource.Messaging.IMessageFactory.CreateJsonPatchMessage ( string  subject,
string  json 
)

Creates a JSON patch message for the given subject.

Parameters
subjectThe subject.
jsonThe JSON patch string.
Returns
A new JSON message.
IMappingMessage Caplin.DataSource.Messaging.IMessageFactory.CreateMappingMessage ( string  subject,
string  mapping 
)

Create a new mapping message;

Parameters
subjectThe original subject.
mappingThe new subject that the remote peer must request to satisfy the subscription.
Returns
A new mapping message.
INewsMessage Caplin.DataSource.Messaging.IMessageFactory.CreateNewsMessage ( string  subject,
string  headline,
string  storyReference,
string  newsDateTime 
)

Creates a News message for the given subject.

Parameters
subjectThe subject identifying the news message.
headlineThe news headline.
storyReferenceThe reference to the news story associated with the headline.
newsDateTimeThe date and time of the news headline.
Returns
A new News message.
IPageMessage Caplin.DataSource.Messaging.IMessageFactory.CreatePageMessage ( string  subject,
int  maxColumns,
int  maxRows 
)

Creates a Page message for the given subject.

Parameters
subjectThe subject of the page message.
maxColumnsThe maximum horizontal size of the page in columns of text characters.
maxRowsThe maximum vertical size of the page in rows of text.
Returns
A new Page Message.

The returned message contains no data. To populate the message with data, use the appropriate methods of Caplin.DataSource.Messaging.Page.IPageMessage.

IPermissionMessage Caplin.DataSource.Messaging.IMessageFactory.CreatePermissionMessage ( string  subject,
string  key 
)

Creates a Permission message for the given subject.

Parameters
subjectThe subject of the Permission message.
keyThe permission key.
Returns
A new Permission message.

The returned message contains no data. To populate the message with data, use the appropriate methods of Caplin.DataSource.Messaging.Permission.IPermissionMessage.

IRecordType1Message Caplin.DataSource.Messaging.IMessageFactory.CreateRecordType1Message ( string  subject)

Creates a Record message to which Type 1 structured data can be added.

Parameters
subjectThe subject of the Record.
Returns
A new Type 1 Record message.

The returned message contains no data. To populate the message with data, use the appropriate methods of Caplin.DataSource.Messaging.Record.IRecordType1Message.

IRecordType2Message Caplin.DataSource.Messaging.IMessageFactory.CreateRecordType2Message ( string  subject,
string  type2Indexfield,
string  type2IndexValue 
)

Creates a Record message to which Type 2 structured data can be added.

Parameters
subjectThe subject of the Record.
type2IndexfieldField name of the type2 index.
type2IndexValueThe value of the type2 index.
Returns
A new Type 2 Record message.

The returned message contains no data. To populate the message with data, use the appropriate methods of Caplin.DataSource.Messaging.Record.IRecordType2Message.

IRecordType3Message Caplin.DataSource.Messaging.IMessageFactory.CreateRecordType3Message ( string  subject)

Creates a Record message to which Type 3 structured data can be added.

Parameters
subjectThe subject of the Record.
Returns
A new Type 3 Record message.

The returned message contains no data. To populate the message with data, use the appropriate methods of Caplin.DataSource.Messaging.Record.IRecordType3Message.

IStatusEvent Caplin.DataSource.Messaging.IMessageFactory.CreateStatusEvent ( SubjectStatus  status,
string  message 
)

Creates a status event.

Parameters
statusThe status.
messageA free form textual message indicating the reason for the status message being raised.
Returns
A subject status event.

The following example shows how to create an IStatusEvent, and send it for all requested subjects to all peers that have requested those subjects.

namespace DataSourceExamples.Messaging
{
public class SendStatusEvent
{
void SendStatusToSubscribedPeers(IActivePublisher publisher)
{
// Create a Stale status event.
IStatusEvent ev = publisher.MessageFactory.CreateStatusEvent(SubjectStatus.Stale, "Object is stale");
// And publish it for all requested subjects to all subscribed peers.
publisher.PublishStatusEventToAllSubjects(ev);
}
}
}
IStoryMessage Caplin.DataSource.Messaging.IMessageFactory.CreateStoryMessage ( string  subject,
string  text 
)

Creates a story message for the given subject.

Parameters
subjectThe subject.
textThe story text.
Returns
A new Story message.
ISubjectErrorEvent Caplin.DataSource.Messaging.IMessageFactory.CreateSubjectErrorEvent ( string  subject,
SubjectError  error,
params SubjectErrorFlags[]  flags 
)

Creates a subject error event.

Parameters
subjectThe subject to which the error relates.
errorThe error.
flagsAdditional Flags to be applied to the SubjectError message.
Returns
A subject error event.

The following example shows how to create an ISubjectErrorEvent for a specified subject, and send it to all peers that have requested that subject:

namespace DataSourceExamples.Messaging
{
public class ClassSubjectError
{
public void SendSubjectErrorEvent(IPublisher publisher, string subject)
{
// Create an ISubjectErrorEvent.
ISubjectErrorEvent ev = publisher.MessageFactory.CreateSubjectErrorEvent(subject, SubjectError.NotFound);
// Distribute the error to all peers that have requested this subject.
publisher.PublishSubjectErrorEvent(ev);
}
}
}
ISubjectStatusEvent Caplin.DataSource.Messaging.IMessageFactory.CreateSubjectStatusEvent ( string  subject,
SubjectStatus  status,
string  message 
)

Creates a subject status event.

Parameters
subjectThe subject to which the status relates.
statusThe status.
messageA free form textual message indicating the reason for the status message being raised.
Returns
A subject status event.

The following example shows how to create an ISubjectStatusEvent for a specified subject, and send it to all peers that have requested that subject.

namespace DataSourceExamples.Messaging
{
public class SendSubjectStatusEvent
{
void SendSubjectStatusToSubscribedPeers(IPublisher publisher, string subject)
{
// Create a Stale subject status event.
ISubjectStatusEvent ev = publisher.MessageFactory.CreateSubjectStatusEvent(subject, SubjectStatus.Stale, "Object is stale");
// And publisher to all subscribed peers.
publisher.PublishSubjectStatusEvent(ev);
}
}
}
IWrapperMessage Caplin.DataSource.Messaging.IMessageFactory.CreateWrapperMessage ( string  subject)

Create a new wrapper message;

Parameters
subjectThe subject.
Returns
A new wrapper message.

Generated on Wed Mar 8 2023 19:11:38 for DataSource.NET