Engine Events
The Engine class exposes the following events:
Event | Description |
---|---|
Error | Error condition is detected |
IncomingTelecommunicationLink | Incoming telecommunication link is detected |
IncomingConnection | Incoming FIX Connection is detected. |
UnknownIncomingConnection | Unknown incoming FIX Connection is detected, see Accepting FIX Session Without a Prior Creation of Session Object |
Warning | Warning condition is detected |
Note
Engine event handling is a synchronous operation. Avoid performing time-consuming tasks inside event handlers.
For example:
engine.Error += (object sender, EngineErrorEventArgs e) =>
{
Console.WriteLine($"Error condition is detected: {e}");
};
engine.IncomingTelecommunicationLink += (object sender, IncomingTelecommunicationLinkEventArgs e) =>
{
Console.WriteLine($"Incoming telecommunication link: {e}");
};
engine.IncomingConnection += (object sender, IncomingConnectionEventArgs e) =>
{
Console.WriteLine($"Incoming connection: {e}");
};
engine.UnknownIncomingConnection += (object sender, UnknownIncomingConnectionEventArgs e) =>
{
Console.WriteLine($"Unknown incoming connection: {e}");
};
engine.Warning += (object sender, EngineWarningEventArgs e) =>
{
Console.WriteLine($"Warning condition is detected: {e}");
};
Rejecting Incoming Telecommunication Link
To reject the incoming telecommunication link, set AcceptConnection to false
.
For example:
engine.IncomingTelecommunicationLink += (object sender, IncomingTelecommunicationLinkEventArgs e) =>
{
Console.WriteLine($"Incoming telecommunication link will be rejected: {e}");
e.AcceptConnection = false;
};
Rejecting Incoming Connection
To reject the incoming connection, put any reason text to RejectReason or leave it blank to accept. Please, pay attention that the text will be send to Initiator in a logout message if SendLogoutOnInvalidLogon is true.
For example:
engine.IncomingConnection += (object sender, IncomingConnectionEventArgs e) =>
{
Console.WriteLine($"Incoming connection will be rejected: {e}");
e.RejectReason = "Wrong logon details";
};