Throttle a single subjects updates from the Liberator
Declaration Syntax
C# | Visual Basic | Visual C++ |
void ThrottleObject( ICommandListener listener, string subject, IThrottleParameters parameters )
Sub ThrottleObject ( _ listener As ICommandListener, _ subject As String, _ parameters As IThrottleParameters _ )
void ThrottleObject( ICommandListener^ listener, String^ subject, IThrottleParameters^ parameters )
Parameters
- listener (ICommandListener)
- The command listener.
- subject (String)
- The subject to throttle.
- parameters (IThrottleParameters)
- The throttle parameters
Examples
CopyC#
using Caplin.StreamLink; using Caplin.StreamLink.Authentication; using Caplin.StreamLink.Command; using Caplin.StreamLink.Subscription.Record; using StreamLinkExamples.Record; namespace StreamLinkExamples.Commands { /// <summary> /// Throttle a Subject example /// </summary> public class ThrottleASubject { /// <summary> /// Example of how to throttle updates to a subject from the Liberator. /// </summary> public static void CreateThrottleASubjectExample() { StreamLink myStreamLink = new StreamLink(); myStreamLink.CredentialsProvider = new PasswordCredentialsProvider("admin", "admin"); // Connect myStreamLink.StreamLinkProvider.Connect(); // create a listener for record updates IRecordSubscriptionListener exampleRecordSubscriptionListener = new ExampleRecordSubscriptionListener(); // subscribe to a record IRecordSubscriptionParameters recordParams = myStreamLink.StreamLinkProvider.ParametersFactory.CreateRecordSubscriptionParameters(); IRecordSubscription sub = myStreamLink.StreamLinkProvider.CreateRecordSubscription(exampleRecordSubscriptionListener, "Subject", recordParams); sub.Subscribe(); // Throttle subject, set to max level IThrottleParameters parameters = myStreamLink.StreamLinkProvider.ParametersFactory.CreateThrottleParameters(ThrottleControl.Max); // listener called when the throttle command has finished executing ICommandListener listener = new ExampleCommandListener(); myStreamLink.StreamLinkProvider.ThrottleObject(listener, "Subject", parameters); } } }