StreamLink.NET
Publish Method (listener, subjectName, parameters)
StreamLink.NETCaplin.StreamLinkIStreamLinkProviderPublish(ICommandListener, String, IPublishParameters)
Publishes information (updates) to the Liberator.
Declaration Syntax
C#Visual BasicVisual C++
void Publish(
	ICommandListener listener,
	string subjectName,
	IPublishParameters parameters
)
Sub Publish ( _
	listener As ICommandListener, _
	subjectName As String, _
	parameters As IPublishParameters _
)
void Publish(
	ICommandListener^ listener, 
	String^ subjectName, 
	IPublishParameters^ parameters
)
Parameters
listener (ICommandListener)
The listener that will receive the results of the publish command.
subjectName (String)
The name of the subject to publish to (update).
parameters (IPublishParameters)
The parameters of the publish command. To obtain an IPublishParameters object, first obtain the IParametersFactory associated with the IStreamLinkProvider. Then call the CreatePublishParameters(Dictionary<(Of <(String, String>)>)) method on the IParametersFactory supplying as field name and value pairs the data to be updated. This call will return a valid IPublishParameters object.
Remarks

An API client can publish updates to any subject to which it has write access, regardless of whether the object was created by itself, by another StreamLink client, or by one of the server's DataSources. If the object was created by a DataSource then the values will be passed on to that DataSource for processing.

Note 1: At present the Liberator will only accept updates to subjects of type Record or Chat. You can publish data for record fields that do not exist at the time of publication; if the Liberator owns the record item it will create the new fields.

You can send a chat message by publishing an update to the Chat object using specific parameters. See: CreateChatPublishParameters(String).

Note 2: If an application publishes values for a record that is owned by a DataSource, the Liberator passes the updates on to the DataSource. If the updated record contains new fields, the DataSource may or may not create the new fields, depending on how it is coded and configured. If the DataSource rejects the new fields, the publication command may still appear to succeed.

Examples
CopyC#
using System;
using System.Collections.Generic;
using System.Text;
using Caplin.StreamLink;
using Caplin.StreamLink.Authentication;
using Caplin.StreamLink.Command;

namespace StreamLinkExamples.Commands
{
    public class PublishToSubject
    {
        /// <summary>
        /// Example of how to create a new Record subject on the Liberator.
        /// </summary>
        public static void PublishToASubjectExample()
        {
            IStreamLink myStreamLink = new StreamLink();
            myStreamLink.CredentialsProvider = new PasswordCredentialsProvider("admin", "admin");

            myStreamLink.StreamLinkProvider.Connect();

            // Identify the fields to be published to and the values to be published.
            Dictionary<string,string> fieldsAndValues = new Dictionary<string,string>();
            fieldsAndValues.Add("Bid", "200");
            fieldsAndValues.Add("Volume", "10000");

            // Create the publish parameters using the fields and their values.
            IPublishParameters publishParameters =
                myStreamLink.StreamLinkProvider.ParametersFactory.CreatePublishParameters(fieldsAndValues);

            // listener called when the command has finished executing
            ICommandListener listener = new ExampleCommandListener();

            // Submit the publish command
            myStreamLink.StreamLinkProvider.Publish(listener, "Subject", publishParameters);
        }
    }
}

Assembly: Caplin.StreamLink (Module: Caplin.StreamLink) Version: 5.0.23.0 (5.0.23.0)