Creates a subject (data item) on the Liberator.
Declaration Syntax
C# | Visual Basic | Visual C++ |
void CreateSubject( ICommandListener listener, string subject, ICreateParameters parameters )
Sub CreateSubject ( _ listener As ICommandListener, _ subject As String, _ parameters As ICreateParameters _ )
void CreateSubject( ICommandListener^ listener, String^ subject, ICreateParameters^ parameters )
Parameters
- listener (ICommandListener)
- The listener that will receive the results of the create subject command.
- subject (String)
- The subject to create.
- parameters (ICreateParameters)
- The parameters of the subject creation command.
Remarks
A subject can only be created if the following conditions are met:
- The name supplied in the subject parameter is not in a namespace owned by a DataSource. For example if a DataSource owns the namespace “/EUR*”, StreamLink cannot create a subject with the name “/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(); } } }