StreamLink.NET
CreateSubject Method (listener, subjectName, parameters)
StreamLink.NETCaplin.StreamLinkIStreamLinkProviderCreateSubject(ICommandListener, String, ICreateParameters)
Creates a subject (data item) on the Liberator.
Declaration Syntax
C#Visual BasicVisual C++
void CreateSubject(
	ICommandListener listener,
	string subjectName,
	ICreateParameters parameters
)
Sub CreateSubject ( _
	listener As ICommandListener, _
	subjectName As String, _
	parameters As ICreateParameters _
)
void CreateSubject(
	ICommandListener^ listener, 
	String^ subjectName, 
	ICreateParameters^ parameters
)
Parameters
listener (ICommandListener)
The listener that will receive the results of the create subject command.
subjectName (String)
The name of the subject to be created. For example "/FX/EURUSD".
parameters (ICreateParameters)
The parameters of the subject creation command. To obtain an ICreateParameters object, first obtain the IParametersFactory associated with the IStreamLinkProvider. Then call the CreateCreateParameters(SubjectType) method on the IParametersFactory supplying the required SubjectType (data item type); this will return a valid ICreateParameters object.
Remarks

A subject can only be created if the following conditions are met:

  • The name supplied in the subjectName parameter is not in a namespace owned by a DataSource. For example if a DataSource owns the namespace "/FX/EUR*", StreamLink cannot create a subject with the name "/FX/EURUSD".
  • The user account under which StreamLink is logged in to the Liberator allows write access to the directory where the subject is to be created.
  • The directory exists.

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
{
    /// <summary>
    /// Create a Subject example
    /// </summary>
    public class CreateASubject
    {
        /// <summary>
        /// Example of how to create a new Record subject on the Liberator.
        /// </summary>
        public static void CreateASubjectExample()
        {
            StreamLink myStreamLink = new StreamLink();
            myStreamLink.CredentialsProvider = new PasswordCredentialsProvider("admin", "admin");

            ICreateParameters createParameters =
                myStreamLink.StreamLinkProvider.ParametersFactory.CreateCreateParameters(SubjectType.Record);

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

            // Create command call with be queued
            myStreamLink.StreamLinkProvider.CreateSubject(listener, "Subject", createParameters);

            // Create subject call will be dequeued and executed.
            myStreamLink.StreamLinkProvider.Connect();
        }
    }
}

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