Creates parameters for a container subscription, specifying the window range of the container.
Declaration Syntax
C# | Visual Basic | Visual C++ |
IContainerSubscriptionParameters CreateContainerSubscriptionParameters( int windowStartIndex, int windowSize )
Function CreateContainerSubscriptionParameters ( _ windowStartIndex As Integer, _ windowSize As Integer _ ) As IContainerSubscriptionParameters
IContainerSubscriptionParameters^ CreateContainerSubscriptionParameters( int windowStartIndex, int windowSize )
Return Value
The container subscription parameters.
Examples
CopyC#
using System; using System.Collections.Generic; using System.Text; using Caplin.StreamLink; using Caplin.StreamLink.Authentication; using Caplin.StreamLink.Subscription.Container; using Caplin.StreamLink.Subscription.Record; using StreamLinkExamples.Record; namespace StreamLinkExamples.Container { public class CreateContainerSubscriptionWithStartIndexAndCount { /// <summary> /// Create a subscription to a container, passing in container subscription parameters /// object which defines we are subscribing to the first 10 elements within the container /// </summary> public static void CreateContainerSubscriptionWithStartIndexAndCountExample() { IStreamLink myStreamLink = new StreamLink(); myStreamLink.CredentialsProvider = new PasswordCredentialsProvider("admin", "admin"); // Set up a subscription listener to receive updates for the container IContainerSubscriptionListener subscriptionListener = new ExampleContainerSubscriptionListener(); // Setup a subscription listener to receive updates to the // records that the container is subscribed to. IRecordSubscriptionListener recordSubscriptionListener = new ExampleRecordSubscriptionListener(); // Subscribe from the 1st element within the container // (the start of the window). // The first element has an index of zero (0). int containerStartIndex = 0; // Subscribe to 10 elements in the container // (the size of the window). int containerElementCount = 10; // Set up the container subscription parameters that specify the // container window IContainerSubscriptionParameters parameters = myStreamLink.StreamLinkProvider.ParametersFactory.CreateContainerSubscriptionParameters( containerStartIndex, containerElementCount); // Creaet a new subscription to the container /DEMO/CONTAINER/DCONT IContainerSubscription subscription = myStreamLink.StreamLinkProvider.CreateContainerSubscription(subscriptionListener, "/DEMO/CONTAINER/DCONT", parameters); // Associate the record subscription listener with the container subscription // listener BEFORE subscribing. // This ensures that all subsequent record updates are received. subscription.RecordSubscriptionListener = recordSubscriptionListener; // Subscribe to the container subscription.Subscribe(); myStreamLink.StreamLinkProvider.Connect(); } } }