OnixS C++ FIX Engine  4.12.0
API Documentation
Throttler Class Reference

#include <OnixS/FIXEngine/FIX/Throttler.h>

Public Member Functions

 Throttler (size_t messagesCount, size_t intervalInMs=1000)
 
 ~Throttler ()
 
void throttle ()
 
size_t tryThrottle (bool resetWhenDelay=false)
 
void reset (size_t messagesCount, size_t intervalInMs=1000)
 

Detailed Description

Definition at line 30 of file Throttler.h.

Constructor & Destructor Documentation

Throttler ( size_t  messagesCount,
size_t  intervalInMs = 1000 
)

The constructor.

Parameters
messagesCountThe message limit per time unit.
intervalInMsThe time interval to limit messages.
~Throttler ( )

The destructor.

Member Function Documentation

void reset ( size_t  messagesCount,
size_t  intervalInMs = 1000 
)

Resets the throttling parameters.

Parameters
messagesCountThe message limit per time unit.
intervalInMsThe time interval to limit messages.
void 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.

size_t tryThrottle ( bool  resetWhenDelay = false)

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 (in milliseconds) until the action becomes possible. Otherwise, it returns 0.

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

The documentation for this class was generated from the following file: