Message Throttling
Many venues have limits of sending messages per time unit (throttling). If an application sends messages too often, then they can be rejected.
To not exceeds the limits, there is the Throttle() method.
This method performs the throttling of a session. It must be called before each of a send function call.
If the count of messages per a time unit exceeds a throttling limit, the function will be blocked until the given time interval is passed.
The ThrottlingLimit(Int32, Int32) method is used to set throttling limit parameters:
Example using FIXForge.NET.FIX;
const int MessagesPerSecondLimit = 10;
const int ThrottlingIntervalMillisecond = 1000;
const string AcceptorHost = "localhost";
const int AcceptorPort = 5000;
Message order = new Message("D", ProtocolVersion.FIX42);
Session session = new Session("Sender", "Target", ProtocolVersion.FIX44);
session.ThrottlingLimit(MessagesPerSecondLimit, ThrottlingIntervalMillisecond);
session.LogonAsInitiator(AcceptorHost, AcceptorPort);
for (int counter = 0; 100 > counter; ++counter)
{
session.Throttle();
session.Send(order);
}