forwardAsynchronous Processing of Incoming Messages   Table of ContentEstablishing FIX Connection via Proxyforward
Message Throttling
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
C#
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);

// Set throttling limit parameters.
session.ThrottlingLimit(MessagesPerSecondLimit, ThrottlingIntervalMillisecond);

session.LogonAsInitiator(AcceptorHost, AcceptorPort);

// Emulate some sending flow of an application.
for (int counter = 0; 100 > counter; ++counter)
{
    // This method must be called before each of a send function call.
    // If the count of messages (10 in our case) per a time unit (1 sec in our case) exceeds a throttling limit,
    // this function will be blocked until the given time interval is passed.
    session.Throttle();
    // A regular send call, which should be throttled.
    session.Send(order);
}