A factory for creating the parameters required when issuing commands
and subscription requests to StreamLink.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public interface IParametersFactory
Public Interface IParametersFactory
public interface class IParametersFactory
Members
All Members | Methods | ||||
Icon | Member | Description |
---|---|---|
CreateChatPublishParameters(String) |
Creates parameters for sending a new chat message to Liberator.
| |
CreateChatSubscriptionParameters()()() |
Creates parameters for creating a new Chat object on the Liberator.
| |
CreateContainerSubscriptionParameters()()() |
Creates default parameters for a container subscription (specifies the whole container).
| |
CreateContainerSubscriptionParameters(Int32, Int32) |
Creates parameters for a container subscription, specifying the window range of the container.
| |
CreateContainerSubscriptionParameters(IRecordSubscriptionParameters) |
Creates parameters for a container subscription, including the fields to be requested
and/or an update filter.
| |
CreateContainerSubscriptionParameters(Int32, Int32, IRecordSubscriptionParameters) |
Creates parameters for a container subscription specifying the window range of the container,
the fields to be requested, and/or an update filter.
| |
CreateCreateParameters(SubjectType) |
Creates parameters for creating a new subject on the Liberator.
| |
CreateDeleteParameters()()() |
Creates parameters for deleting a subject from the Liberator.
| |
CreateDirectorySubscriptionParameters()()() |
Creates parameters for creating a new directory on the Liberator.
| |
CreateNewsSubscriptionParameters(String) |
Creates parameters for a news headline subscription, specifying a filter that restricts the
information returned in updates on the subject.
| |
CreateNewsSubscriptionParameters()()() |
Creates an empty set of parameters for a news headline subscription.
| |
CreatePageSubscriptionParameters()()() |
Creates Parameters for creating a new Page on the Liberator.
| |
CreatePageSubscriptionParameters(IList<(Of <(Int32>)>)) |
Creates Parameters for creating a new Page on the Liberator.
| |
CreatePermissionSubscriptionParameters()()() |
Creates parameters for creating a new Permission on the Liberator.
| |
CreatePublishParameters(Dictionary<(Of <(String, String>)>)) |
Creates parameters for publishing information to the Liberator.
| |
CreateRecordSubscriptionParameters()()() |
Creates default parameters for a record subscription. All fields of the record will be subscribed to
with no filtering (see Remarks).
| |
CreateRecordSubscriptionParameters(array<String>[]()[]) |
Creates parameters for a record subscription, defining which fields will be requested.
| |
CreateRecordSubscriptionParameters(String) |
Creates parameters for a record subscription, specifying a filter that restricts the
information returned in updates on the subject.
| |
CreateRecordSubscriptionParameters(array<String>[]()[], String) |
Creates the parameters for a record subscription, defining which fields will be requested
and specifying a filter that restricts the information returned in updates on the subject.
| |
CreateStorySubscriptionParameters()()() |
Creates parameters for creating a new Story on the Liberator.
| |
CreateThrottleParameters(ThrottleControl) |
Creates the throttle parameters used to throttle information from the Liberator.
|
Remarks
The ParametersFactory
The IParametersFactory has a set of specialized methods;
each method returns a parameters object with the appropriate format
for a particular type of command or subscription request.
You obtain an IParametersfactory from the ParametersFactory property of the IStreamLink provider associated with the StreamLink instance.
Examples
An example of creating an IRecordSubscriptionParameters using the ParametersFactory.
CopyC#
using System; using System.Collections.Generic; using System.Text; using Caplin.StreamLink; using Caplin.StreamLink.Authentication; using Caplin.StreamLink.Subscription.Record; namespace StreamLinkExamples.Record { /// <summary> /// Various examples of how to create an IRecordSubscription using the /// IStreamLinkProvider interface. /// </summary> public class CreateRecordSubscriptionWithFields { /// <summary> /// Creates a simple record subscription with no parameters. /// </summary> public static void CreateRecordSubscriptionWithFieldsExample() { // Set up StreamLink and login credentials IStreamLink myStreamLink = new StreamLink(); myStreamLink.CredentialsProvider = new PasswordCredentialsProvider("admin", "admin"); // Set up listener and created the subscription for /DEMO/MSFT IRecordSubscriptionListener listener = new ExampleRecordSubscriptionListener(); string[] fields = new string[] { "Bid", "Ask" }; IRecordSubscriptionParameters parameters = myStreamLink.StreamLinkProvider.ParametersFactory.CreateRecordSubscriptionParameters(fields); // Create subscription, specifying fields Bid and Ask IRecordSubscription subscription = myStreamLink.StreamLinkProvider.CreateRecordSubscription(listener, "/DEMO/MSFT", parameters); // Subscribe the subscription, this will be queued until we // login to the Liberator subscription.Subscribe(); // Finally, connect to the Liberator myStreamLink.StreamLinkProvider.Connect(); } } }
An example of creating an IDirectorySubscriptionParameters using the ParametersFactory.
CopyC#
using System; using Caplin.StreamLink; using Caplin.StreamLink.Authentication; using Caplin.StreamLink.Subscription.Directory; namespace StreamLinkExamples.Directory { /// <summary> /// Example of how to create a directory subscription using parameters. /// </summary> public class CreateDirectorySubscriptionWithParameters { /// <summary> /// Creates a simple directory subscription with no parameters. /// </summary> public static void CreateADirectorySubscriptionWithParametersExample() { // Set up StreamLink and login credentials IStreamLink myStreamLink = new StreamLink(); myStreamLink.CredentialsProvider = new PasswordCredentialsProvider("admin", "admin"); // Finally, connect to the Liberator myStreamLink.StreamLinkProvider.Connect(); // Set up listener and created the subscription for /DEMO IDirectorySubscriptionListener listener = new ExampleDirectorySubscriptionListener(); IDirectorySubscriptionParameters parameters = myStreamLink.StreamLinkProvider.ParametersFactory.CreateDirectorySubscriptionParameters(); IDirectorySubscription subscription = myStreamLink.StreamLinkProvider.CreateDirectorySubscription(listener, "/DEMO", parameters); // Subscribe the subscription, this will be queued until we // login to the Liberator subscription.Subscribe(); } } }
An example of creating an IPublishParameters using the ParametersFactory.
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); } } }