• Version 1.15.2
Show / Hide Table of Contents

Class Throttler

Creates a Throttler.

Inheritance
object
Throttler
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OnixS.Fix
Assembly: OnixS.Fix.Engine.dll
Syntax
public class Throttler

Constructors

Throttler(int, TimeSpan)

Creates a Throttler.

Declaration
public Throttler(int messagesCount, TimeSpan throttlingInterval)
Parameters
Type Name Description
int messagesCount

The message limit per time unit.

TimeSpan throttlingInterval

The time interval to limit messages.

Methods

Reset(int, TimeSpan)

Resets the throttling parameters.

Declaration
public void Reset(int messagesCount, TimeSpan throttlingInterval)
Parameters
Type Name Description
int messagesCount

The message limit per time unit.

TimeSpan throttlingInterval

The time interval to limit messages.

Throttle()

Performs the throttling. This method must be called before each action that should be throttled. If the count of messages per time unit exceeds the throttling limit, the function will be blocked until the given time interval is passed.

Declaration
public void Throttle()

TryThrottle(bool)

Checks the throttling. This method must be called before each action that should be throttled. If the count of messages per time unit exceeds the throttling limit, the function returns the delay until the action becomes possible. Otherwise, it returns TimeSpan.Zero.

Declaration
public TimeSpan TryThrottle(bool resetWhenDelay = false)
Parameters
Type Name Description
bool resetWhenDelay

The flag indicates if the calculation of messages per throttling interval should be reset and started again when a delay is returned.

Returns
Type Description
TimeSpan
In this article
Back to top Copyright © Onix Solutions.
Generated by DocFX