• Version 1.15.2
Show / Hide Table of Contents

Interface ISession

A FIX Session.

It is defined as a bi-directional stream of ordered messages between two parties within a continuous sequence number series. A single FIX session can exist across multiple sequential (not concurrent) physical connections. A FIX Connection is comprised of three parts: logon, message exchange, and logout. A FIX Session is comprised of one or more FIX Connections, meaning that a FIX Session spans multiple logins. Parties can connect and disconnect multiple times while maintaining a single FIX session. Connecting parties must bi-laterally agree as to when sessions are to be started/stopped based upon individual system and time zone requirements. Resetting the inbound and outbound sequence numbers back to 1, for whatever reason, constitutes the beginning of a new FIX session.

Inherited Members
IDisposable.Dispose()
Namespace: OnixS.Fix
Assembly: OnixS.Fix.Engine.dll
Syntax
public interface ISession : IDisposable

Properties

ConsiderRejectOnResendRequestAsGapFill

By default if the "Session Level Reject" message is received in replay to the "Resend Request" then this is considered as a serious problem and the FIX connection will be closed. This property allows to change this behavior and consider the "Session Level Reject" on the "Resend Request" as the "Sequence Reset Gap Fill" message.

Declaration
bool ConsiderRejectOnResendRequestAsGapFill { get; set; }
Property Value
Type Description
bool

Consider the "Session Level Reject" on the "Resend Request" as the "Sequence Reset Gap Fill" message

CounterpartyHost

Counterparty host name.

Declaration
string CounterpartyHost { get; }
Property Value
Type Description
string

Counterparty host name

CounterpartyIpAddress

Counterparty IP address.

Declaration
IPAddress CounterpartyIpAddress { get; }
Property Value
Type Description
IPAddress

Counterparty IP address

CounterpartyPort

Counterparty port number.

Declaration
int CounterpartyPort { get; }
Property Value
Type Description
int

Counterparty port

CreationTime

The time when the session instance was created or the last local reset of sequence numbers was performed.

Declaration
DateTime CreationTime { get; }
Property Value
Type Description
DateTime

Session's creation time

CustomKey

Custom key that can be used to distinguish sessions with the same values of the SenderCompID, TargetCompID and the FIX Protocol version.

Declaration
string CustomKey { get; }
Property Value
Type Description
string

Custom key

Dictionary

Session's Dictionary.

Declaration
IMessageInfoDictionary Dictionary { get; }
Property Value
Type Description
IMessageInfoDictionary

Session's Dictionary

Encryption

Method of encryption

Declaration
EncryptionMethod Encryption { get; set; }
Property Value
Type Description
EncryptionMethod

HeartBtInt

Gets the Heartbeat interval (seconds, HeartBtInt, tag=108 field value).

Declaration
int HeartBtInt { get; }
Property Value
Type Description
int

The Heartbeat interval (seconds, HeartBtInt, tag=108 field value).

IgnoreLessThanExpectedSequenceNumber

By default if the incoming message has a sequence number less than expected and the PossDupFlag is not set, it indicates a serious error and leads to FIX connection closing. This property allows to change this behavior and consider the sequence number of the incoming message, which less than expected, as an expected one.

Declaration
bool IgnoreLessThanExpectedSequenceNumber { get; set; }
Property Value
Type Description
bool

InSeqNum

The expected sequence number of the next incoming message.

Declaration
int InSeqNum { get; set; }
Property Value
Type Description
int

The expected sequence number of the next incoming message.

InboundMessageLogFilter

Incoming message types to be filtered out from the logs.

Declaration
string[] InboundMessageLogFilter { get; set; }
Property Value
Type Description
string[]

Incoming message types to be filtered out from the logs.

IncomingMessageGapQueueMaximumSize

Returns maximum size of the incoming message gap queue.

Declaration
int IncomingMessageGapQueueMaximumSize { get; set; }
Property Value
Type Description
int

maximum size of the incoming message gap queue.

KeepSequenceNumbersBetweenFixConnections

Option to keep sequence numbers after the exchange of Logout (MsgType=5) messages.

By default the value is true.

Declaration
bool KeepSequenceNumbersBetweenFixConnections { get; set; }
Property Value
Type Description
bool

whether to keep sequence numbers after the exchange of Logout (MsgType=5) messages

ListenPort

Port to listen on for incoming connections in Acceptor mode.

Declaration
int ListenPort { get; set; }
Property Value
Type Description
int

Port to listen on for incoming connections in Acceptor mode

LocalNetworkInterface

The network interface for establishing the TCP connection as an Initiator.

The default value is LocalNetworkInterface.

Declaration
IPAddress LocalNetworkInterface { get; set; }
Property Value
Type Description
IPAddress

The network interface for establishing the TCP connection as an Initiator

LocalPort

Returns the local port that is used by the outgoing connection.

Declaration
int LocalPort { get; }
Property Value
Type Description
int

Local ports

See Also
LocalPortRange

LocalPortRange

The local port range for outgoing connections, the first available port from this range will be used to send and receive data.

By default, a random port will be used.

Declaration
PortRange LocalPortRange { get; set; }
Property Value
Type Description
PortRange

Local port range.

LogBeforeSending

Option to switch on/off logging of outbound messages before/after sending.

/// The default value is LogBeforeSending.

Declaration
bool LogBeforeSending { get; set; }
Property Value
Type Description
bool

'true' if outbound messages are logged before sending, otherwise - 'false'.

LogInboundMessages

Store inbound messages in the session storage.

The default value is LogInboundMessages.

Declaration
bool LogInboundMessages { get; set; }
Property Value
Type Description
bool

Store inbound messages in the session value

LogOutboundMessages

Store outbound messages in the session storage.

/// The default value is LogOutboundMessages.

Declaration
bool LogOutboundMessages { get; set; }
Property Value
Type Description
bool

Store outbound messages in the session storage

MessageGrouping

Message sending grouping.

The default value is MessageGrouping.

Declaration
int MessageGrouping { get; set; }
Property Value
Type Description
int

Value 0 means the default grouping - the messages will be sent ASAP and pending messages (if any) will be grouped until reaching the TCP buffer size. Value 1 means the messages will be sent ASAP and will never be grouped. Value 2 (or greater) means the messages will be sent ASAP and pending messages will be grouped maximum by 2 (or greater).

OutSeqNum

The sequence number of the next outgoing message.

Declaration
int OutSeqNum { get; set; }
Property Value
Type Description
int

the sequence number of the next outgoing message

OutboundMessageLogFilter

Outgoing message types to be filtered out from the logs.

Declaration
string[] OutboundMessageLogFilter { get; set; }
Property Value
Type Description
string[]

Outgoing message types to be filtered out from the logs.

OutboundQueueBytes

Returns the total size of messages in the outgoing queue in bytes.

Declaration
ulong OutboundQueueBytes { get; }
Property Value
Type Description
ulong

the total size of messages in bytes

Proxy

HTTP proxy settings.

Declaration
ProxySettings Proxy { get; }
Property Value
Type Description
ProxySettings

ReceiveBufferSize

TCP socket receive buffer size allocated to FIX connection, in bytes.

The default value is ReceiveBufferSize.

Declaration
int ReceiveBufferSize { get; set; }
Property Value
Type Description
int

TCP socket receive buffer size in bytes

ReceiveSpinningTimeout

The non-blocking receive spinning timeout (in microseconds) before the receiving thread enters into the blocking wait mode.

Should not be greater than 1 sec. (the minimal HeartbeatInterval interval).

The default value is ReceiveSpinningTimeout.

Declaration
int ReceiveSpinningTimeout { get; set; }
Property Value
Type Description
int

Receive spinning timeout (in microseconds)

ReceivingThreadAffinity

Receiving thread affinity.

Declaration
int[] ReceivingThreadAffinity { get; set; }
Property Value
Type Description
int[]

ReceivingThreadPriority

Gets or sets the priority of the session receiving thread.

The default value is set by OS.

Declaration
ThreadPriority ReceivingThreadPriority { get; set; }
Property Value
Type Description
ThreadPriority

The priority of the session receiving thread

ReportNewMessagesWhileWaitingForMissedMessages

When the message gap is detected the "Resend Request" FIX Message is sent and Session state is changed to WaitForRetransmission. By default in this state the incoming new messages (without the PossDupFlag (tag #43) flag) are ignored because we expect them to be re-sent later again with the PossDupFlag flag. This property allows to change this behavior and report the new messages anyway.

Note: In this mode messages could be reported out of the original order: e.g. MsgSeqNum could be: 3 (original), 4 (original), 2 (PossDupFlag='Y'), 3 (PossDupFlag='Y'), 4 (PossDupFlag='Y') and some messages could be received two times: first time without PossDupFlag='Y' and second time - with this flag.

Default value is false.
Declaration
bool ReportNewMessagesWhileWaitingForMissedMessages { get; set; }
Property Value
Type Description
bool

Report new messages even when the message gap is detected and the reply on the "Resend Request" message is expected.

RequestOnlyMissedMessages

By default, the "Resend Request" message requests all messages beginning from the first missed one. This property allows to change this behavior and request only missed messages.

The default is false.

Declaration
bool RequestOnlyMissedMessages { get; set; }
Property Value
Type Description
bool

Request only missed messages

ResendRequestMaximumRange

The maximum number of messages to be requested in one Resend Request(2) message.

The default value is ResendRequestMaximumRange.

Declaration
int ResendRequestMaximumRange { get; set; }
Property Value
Type Description
int

The maximum number of messages to be requested in one Resend Request (MsgType=2) message or ResendRequestMaximumRangeNoLimit for no limit

ResendTimeout

The timeout during which counterparty should send a reply to the Resend Request (MsgType=2) message. If a counterparty does not reply or reply incorrectly during this timeout, then the Warning is called. By default, the resend request timeout equal to zero, which means an infinite timeout.

Declaration
TimeSpan ResendTimeout { get; set; }
Property Value
Type Description
TimeSpan

The timeout during which counterparty should send a reply to the Resend Request (MsgType=2) message.

ResendingBatchSize

The maximum number of messages sent in reply to the Resend Request(2) before temporarily releasing the Session’s lock.

The default value is ResendingBatchSize.

Declaration
int ResendingBatchSize { get; set; }
Property Value
Type Description
int

The maximum number of messages sent in reply to the Resend Request(2) before temporarily releasing the Session’s lock

ResendingQueueSize

The number of sent messages that are available for resending in reply on counterparty's Resend Request(2) message.

The default value is ResendingQueueSize.

Declaration
int ResendingQueueSize { get; set; }
Property Value
Type Description
int

The number of sent messages that are available for resending in reply on counterparty's Resend Request(2) message

ResetLocalSequenceNumbersOnLogon

Option to automatically reset the local sequence numbers to 1 during every logon. The default is the opposite value of keepSequenceNumbersBetweenFixConnections session constructor's parameter.

Declaration
bool ResetLocalSequenceNumbersOnLogon { get; set; }
Property Value
Type Description
bool

whether to automatically reset the local sequence numbers to 1 during every logon

ReuseEventArguments

Reuse event arguments.

Note: If it is turned on, then the client code must copy event arguments for using outside of event handlers.

The default value is false.

Declaration
bool ReuseEventArguments { get; set; }
Property Value
Type Description
bool

Reuse event arguments

ReuseInboundMessage

Reuse the same Message object for incoming messages.

Note: If it is turned on, then the client code must copy the Message object for using outside of inbound event handlers.

The default value is false.

Declaration
bool ReuseInboundMessage { get; set; }
Property Value
Type Description
bool

Reuse the same Message object for incoming messages

Role

Session's role.

Declaration
SessionRole Role { get; }
Property Value
Type Description
SessionRole

Session's role

ScrambledLogonFields

Tags for the Logon(A) message fields to scramble in the session storage for security reasons.

Declaration
Collection<int> ScrambledLogonFields { get; set; }
Property Value
Type Description
Collection<int>

SendBufferSize

TCP socket send buffer size allocated to FIX connection, in bytes.

The default value is SendBufferSize.

Declaration
int SendBufferSize { get; set; }
Property Value
Type Description
int

TCP socket send buffer size in bytes

SendLogoutOnException

Send the Logout message before dropping the telecommunication link in case of an exception during the processing of an incoming FIX message.

The default value is SendLogoutOnException.

Declaration
bool SendLogoutOnException { get; set; }
Property Value
Type Description
bool

option to send or not to send

SendResendRequestOnEachMessageGap

By default the "Resend Request" message is sent only once - when the first gap is detected. This property allows to send the "Resend Request" message on each detected message sequence number gap.

Declaration
bool SendResendRequestOnEachMessageGap { get; set; }
Property Value
Type Description
bool

Send the "Resend Request" message on each detected message sequence number gap

SendSpinningTimeout

The send spinning timeout (in microseconds) of the Send(IMessage) method to wait for the socket sending buffer availability in the spin loop mode before placing the message to the outgoing queue (to be sent later by the sending thread).

Should not be greater than 1 sec (the minimal Heartbeat interval).

The default value is SendSpinningTimeout.

Declaration
int SendSpinningTimeout { get; set; }
Property Value
Type Description
int

The send spinning timeout (in microseconds)

SenderCompId

Assigned value used to identify firm sending message (the SenderCompID (tag 49) field value in outgoing messages).

Declaration
string SenderCompId { get; }
Property Value
Type Description
string

SenderCompID (tag 49) field value

SenderLocationId

The value of the SenderLocationID (tag 142) field that will be set in all outgoing messages.

Declaration
string SenderLocationId { get; set; }
Property Value
Type Description
string

SenderLocationID (tag 142) field value.

SenderSubId

The value of the SenderSubID (tag 50) field that will be set in all outgoing messages.

Declaration
string SenderSubId { get; set; }
Property Value
Type Description
string

SenderSubID (tag 50) field value.

SendingThreadAffinity

Sending thread affinity.

Declaration
int[] SendingThreadAffinity { get; set; }
Property Value
Type Description
int[]

SendingThreadPriority

Gets or sets the priority of the session sending thread.

The default value is set by OS.

Declaration
ThreadPriority SendingThreadPriority { get; set; }
Property Value
Type Description
ThreadPriority

The priority of the session sending thread

SendingTimeFormat

Sets the time format of SendingTime of every sent message. By default, the YYYYMMDDHHMMSSMsec format is used.

Declaration
TimestampFormat SendingTimeFormat { set; }
Property Value
Type Description
TimestampFormat

The time format of the SendingTime (52) field

SetLastMsgSeqNumProcessed

Option to set the LastMsgSeqNumProcessed(369) field in outgoing messages.

The default value is SetLastMsgSeqNumProcessed.

Declaration
bool SetLastMsgSeqNumProcessed { get; set; }
Property Value
Type Description
bool

Set the LastMsgSeqNumProcessed(369) field in outgoing messages

Ssl

Declaration
SslSettings Ssl { get; }
Property Value
Type Description
SslSettings

State

Session's state.

Declaration
SessionState State { get; }
Property Value
Type Description
SessionState

Session's state

StorageDirectory

Inbound and outbound FIX messages and session's state data are stored in this directory.

The default value is StorageDirectory.

Declaration
string StorageDirectory { get; set; }
Property Value
Type Description
string

Storage directory

StorageId

The Id of the session storage.

Declaration
string StorageId { get; }
Property Value
Type Description
string

Session storage id

StorageType

Session's storage type.

Declaration
SessionStorageType StorageType { get; }
Property Value
Type Description
SessionStorageType

Session's storage type.

SupportNextExpectedMsgSeqNum

Option to support the NextExpectedMsgSeqNum field (tag 789) in Logon (MsgType=A) messages.

The default value is SupportNextExpectedMsgSeqNum.

Declaration
bool SupportNextExpectedMsgSeqNum { get; set; }
Property Value
Type Description
bool

Support the NextExpectedMsgSeqNum field (tag 789) in Logon (MsgType=A) messages

TargetCompId

Assigned value used to identify receiving firm (the TargetCompID (tag 56) field value in outgoing messages).

Declaration
string TargetCompId { get; }
Property Value
Type Description
string

TargetCompID (tag 56) field Value

TargetLocationId

The value of TargetLocationID (tag 143) field that will be set in all outgoing messages.

Declaration
string TargetLocationId { get; set; }
Property Value
Type Description
string

TargetLocationID (tag 143) field value.

TargetSubId

The value of the TargetSubID (tag 57) field that will be set in all outgoing messages.

Declaration
string TargetSubId { get; set; }
Property Value
Type Description
string

TargetSubID (tag 57) field value.

TcpNoDelay

Option to improves latency at the expense of throughput (disable/enable Nagle's algorithm).

The default value is TcpNoDelay.

Declaration
bool TcpNoDelay { get; set; }
Property Value
Type Description
bool

Improve latency at the expense of throughput (disable/enable Nagle's algorithm)

UpdateSendingTime

Option to update the SendingTime (52) field in the outgoing message even if it is already set.

The default value is UpdateSendingTime.

Declaration
bool UpdateSendingTime { get; set; }
Property Value
Type Description
bool

Update the SendingTime (52) field in the outgoing message if it is already set

ValidateDuplicatedFields

Option to validate the presence of fields that appears more than once.

The default value is ValidateDuplicatedFields.

Declaration
bool ValidateDuplicatedFields { get; set; }
Property Value
Type Description
bool

Validate the presence of fields that appears more than once

ValidateEmptyFieldValues

Option to validate empty message field values.

The default value is ValidateEmptyFieldValues.

Declaration
bool ValidateEmptyFieldValues { get; set; }
Property Value
Type Description
bool

Validate empty message field values

ValidateFieldValues

Option to validate field values of FIX messages in accordance with the FIX protocol or its FIX Dialect.

The default value is ValidateFieldValues.

Declaration
bool ValidateFieldValues { get; set; }
Property Value
Type Description
bool

Validate message field values

ValidateRepeatingGroupEntryCount

Option to validate that the declared number of repeating group instances is equal to the actual one.

The default value is ValidateRepeatingGroupEntryCount.

Declaration
bool ValidateRepeatingGroupEntryCount { get; set; }
Property Value
Type Description
bool

Validate that the declared number of repeating group instances is equal to the actual one

ValidateRepeatingGroupLeadingField

Option to validate that repeating group starts from required by dialect leading tag.

The default value is ValidateRepeatingGroupLeadingField.

Declaration
bool ValidateRepeatingGroupLeadingField { get; set; }
Property Value
Type Description
bool

Validate that repeating group starts from required by dialect leading tag

ValidateRequiredFields

Validate the presence of required fields.

The default value is ValidateRequiredFields.

Declaration
bool ValidateRequiredFields { get; set; }
Property Value
Type Description
bool

Validate the presence of required fields

ValidateSequenceNumbers

Returns whether to validate incoming message sequence numbers. Default value is true.

Declaration
bool ValidateSequenceNumbers { get; set; }
Property Value
Type Description
bool

whether to validate incoming message sequence numbers

ValidateUnknownFields

Validate that there are no unknown message fields.

The default value is ValidateUnknownFields.

Declaration
bool ValidateUnknownFields { get; set; }
Property Value
Type Description
bool

Validate that there are no unknown message fields.

ValidateUnknownMessages

Validate that there are no unknown messages received.

The default value is ValidateUnknownMessages.

Declaration
bool ValidateUnknownMessages { get; set; }
Property Value
Type Description
bool

Validate that there are no unknown messages received.

Version

Returns the FIX Protocol version.

Declaration
ProtocolVersion Version { get; }
Property Value
Type Description
ProtocolVersion

FIX version

Methods

BreakConnection(bool)

Breaks the FIX connection non-gracefully (without the exchange of Logout (MsgType=5) messages).

Declaration
ISession BreakConnection(bool async = false)
Parameters
Type Name Description
bool async
Returns
Type Description
ISession

ClearOutboundQueue(bool)

Removes all messages from the outbound queue.

Declaration
void ClearOutboundQueue(bool removeFragmentedPacket)
Parameters
Type Name Description
bool removeFragmentedPacket

Specifies whether to remove the last packet, which is partly sent.

FindSentMessage(int)

Finds the sent FIX message by the given message sequence number.

Declaration
IMessage FindSentMessage(int messageSequenceNumber)
Parameters
Type Name Description
int messageSequenceNumber
Returns
Type Description
IMessage

Found message or null if the message is not found

FlushSessionStorage()

Calls Flush() method of the session storage.

Declaration
ISession FlushSessionStorage()
Returns
Type Description
ISession

LogonAsAcceptor()

Establishes FIX Connection as Acceptor.

Acceptor is the receiving party of the FIX session. It listens for the incoming connection on the pre-defined port. The acceptor has responsibility to perform first level authentication and formally declare the connection request "accepted" through transmission of an acknowledgment Logon message.

Declaration
ISession LogonAsAcceptor()
Returns
Type Description
ISession

LogonAsInitiator(IPAddress, int, int, bool, IMessage, bool)

Establishes the FIX connection as Initiator.

Initiator establishes the telecommunications link and initiates the FIX connection via transmission of the initial Logon message.

Declaration
ISession LogonAsInitiator(IPAddress address, int port, int heartBtInt = 30, bool setResetSeqNumFlagInFirstLogon = false, IMessage customLogonMessage = null, bool async = false)
Parameters
Type Name Description
IPAddress address

Counterparty's host Internet Protocol (IP) address

int port

Counterparty's port number

int heartBtInt

Heartbeat interval (seconds)

bool setResetSeqNumFlagInFirstLogon

Set the ResetSeqNumFlag (tag 141) in the initial Logon (MsgType=A) message

IMessage customLogonMessage

Custom Logon message

bool async

If false then the method blocks until the acknowledgment Logon message is received or the Heartbeat interval is elapsed. If true then the method returns immediately without waiting for the acknowledgment Logon message.

Returns
Type Description
ISession
Exceptions
Type Condition
CannotEstablishLinkException

The telecommunication link cannot be established

LinkErrorException

After sending the initial Logon message the telecommunication link error is detected

FirstMessageNotLogonException

The first received message is not a Logon

UnexpectedSequenceNumberException

The first received message has an unexpected sequence number

InvalidInboundLogonException

The first received message is an invalid Logon message

LogonReplyTimeoutException

After sending the initial Logon message the acknowledgment Logon message has not been received during the timeout period. The timeout is calculated using the heartbeat value.

LogonAsInitiator(string, int, int, bool, IMessage, bool)

Establishes the FIX connection as Initiator.

Initiator establishes the telecommunications link and initiates the FIX connection via transmission of the initial Logon message.

Declaration
ISession LogonAsInitiator(string host, int port, int heartBtInt = 30, bool setResetSeqNumFlagInFirstLogon = false, IMessage customLogonMessage = null, bool async = false)
Parameters
Type Name Description
string host

Counterparty's host name or address

int port

Counterparty's port number

int heartBtInt

Heartbeat interval (seconds)

bool setResetSeqNumFlagInFirstLogon

Set the ResetSeqNumFlag (tag 141) in the initial Logon (MsgType=A) message

IMessage customLogonMessage

Custom Logon message

bool async

If false then the method blocks until the acknowledgment Logon message is received or the Heartbeat interval is elapsed. If true then the method returns immediately without waiting for the acknowledgment Logon message.

Returns
Type Description
ISession
Exceptions
Type Condition
CannotEstablishLinkException

The telecommunication link cannot be established

LinkErrorException

After sending the initial Logon message the telecommunication link error is detected

FirstMessageNotLogonException

The first received message is not a Logon

UnexpectedSequenceNumberException

The first received message has an unexpected sequence number

InvalidInboundLogonException

The first received message is an invalid Logon message

LogonReplyTimeoutException

After sending the initial Logon message the acknowledgment Logon message has not been received during the timeout period. The timeout is calculated using the heartbeat value.

LogonAsInitiatorAsync(IPAddress, int, int, bool, IMessage)

Establishes the FIX connection as Initiator.

Initiator establishes the telecommunications link and initiates the FIX connection via transmission of the initial Logon message.

Declaration
Task LogonAsInitiatorAsync(IPAddress address, int port, int heartBtInt = 30, bool setResetSeqNumFlagInFirstLogon = false, IMessage customLogonMessage = null)
Parameters
Type Name Description
IPAddress address

Counterparty's host Internet Protocol (IP) address

int port

Counterparty's port number

int heartBtInt

Heartbeat interval (seconds)

bool setResetSeqNumFlagInFirstLogon

Set the ResetSeqNumFlag (tag 141) in the initial Logon (MsgType=A) message

IMessage customLogonMessage

Custom Logon message

Returns
Type Description
Task

A task that represents the asynchronous logon operation

Exceptions
Type Condition
CannotEstablishLinkException

The telecommunication link cannot be established

LinkErrorException

After sending the initial Logon message the telecommunication link error is detected

FirstMessageNotLogonException

The first received message is not a Logon

UnexpectedSequenceNumberException

The first received message has an unexpected sequence number

InvalidInboundLogonException

The first received message is an invalid Logon message

LogonReplyTimeoutException

After sending the initial Logon message the acknowledgment Logon message has not been received during the timeout period. The timeout is calculated using the heartbeat value.

LogonAsInitiatorAsync(string, int, int, bool, IMessage)

Establishes the FIX connection as Initiator.

Initiator establishes the telecommunications link and initiates the FIX connection via transmission of the initial Logon message.

Declaration
Task LogonAsInitiatorAsync(string host, int port, int heartBtInt = 30, bool setResetSeqNumFlagInFirstLogon = false, IMessage customLogonMessage = null)
Parameters
Type Name Description
string host

Counterparty's host name or address

int port

Counterparty's port number

int heartBtInt

Heartbeat interval (seconds)

bool setResetSeqNumFlagInFirstLogon

Set the ResetSeqNumFlag (tag 141) in the initial Logon (MsgType=A) message

IMessage customLogonMessage

Custom Logon message

Returns
Type Description
Task

A task that represents the asynchronous logon operation

Exceptions
Type Condition
CannotEstablishLinkException

The telecommunication link cannot be established

LinkErrorException

After sending the initial Logon message the telecommunication link error is detected

FirstMessageNotLogonException

The first received message is not a Logon

UnexpectedSequenceNumberException

The first received message has an unexpected sequence number

InvalidInboundLogonException

The first received message is an invalid Logon message

LogonReplyTimeoutException

After sending the initial Logon message the acknowledgment Logon message has not been received during the timeout period. The timeout is calculated using the heartbeat value.

Logout(IMessage, bool)

Terminates the FIX connection.

The provided Logout message is sent to the counterparty.

Declaration
ISession Logout(IMessage logoutMessage, bool async = false)
Parameters
Type Name Description
IMessage logoutMessage

The Logout message to be sent to the counterparty

bool async

If false then the method blocks until the acknowledgment Logout message is received or the Heartbeat interval is elapsed. If true then the method returns immediately without waiting for the acknowledgment Logout message.

Returns
Type Description
ISession

Logout(bool)

Terminates the FIX connection.

The initial Logout message is sent to the counterparty.

Declaration
ISession Logout(bool async = false)
Parameters
Type Name Description
bool async

If false then the method blocks until the acknowledgment Logout message is received or the Heartbeat interval is elapsed. If true then the method returns immediately without waiting for the acknowledgment Logout message.

Returns
Type Description
ISession

Logout(string, bool)

Terminates the FIX connection.

The initial Logout message is sent to the counterparty.

Declaration
ISession Logout(string text, bool async = false)
Parameters
Type Name Description
string text

Free format text string that is sent to the counterparty in the Text (tag=58) field of the initial Logout message

bool async

If false then the method blocks until the acknowledgment Logout message is received or the Heartbeat interval is elapsed. If true then the method returns immediately without waiting for the acknowledgment Logout message.

Returns
Type Description
ISession

LogoutAsync()

Terminates the FIX connection asynchronously.

The initial Logout message is sent to the counterparty.

Declaration
Task LogoutAsync()
Returns
Type Description
Task

A task that represents the asynchronous logout operation

LogoutAsync(IMessage)

Terminates the FIX connection asynchronously.

The provided Logout message is sent to the counterparty.

Declaration
Task LogoutAsync(IMessage logoutMessage)
Parameters
Type Name Description
IMessage logoutMessage

The Logout message to be sent to the counterparty

Returns
Type Description
Task

A task that represents the asynchronous logout operation

LogoutAsync(string)

Terminates the FIX connection asynchronously.

The initial Logout message is sent to the counterparty.

Declaration
Task LogoutAsync(string text)
Parameters
Type Name Description
string text

Free format text string that is sent to the counterparty in the Text (tag=58) field of the initial Logout message

Returns
Type Description
Task

A task that represents the asynchronous logout operation

PreFill(IMessage)

Pre-fills session-level fields that are constant during the session's lifetime: SenderCompId, TargetCompId, SenderLocationId, TargetLocationID, SenderSubID, TargetSubID.

Declaration
ISession PreFill(IMessage message)
Parameters
Type Name Description
IMessage message

Message to pre-fill

Returns
Type Description
ISession

PreFill(SerializedMessage)

Pre-fills session-level fields that are constant during the session's lifetime: SenderCompId, TargetCompId, SenderLocationId, TargetLocationID, SenderSubID, TargetSubID.

Declaration
ISession PreFill(SerializedMessage message)
Parameters
Type Name Description
SerializedMessage message

Message to pre-fill

Returns
Type Description
ISession

ResetLocalSequenceNumbers()

Resets the local sequence numbers to 1 and backups the current log files.

NOTE: This method can be called only when the session is disconnected.

Declaration
ISession ResetLocalSequenceNumbers()
Returns
Type Description
ISession

ResetSequenceNumbersViaLogonExchange()

Sends an intra-connection Logon (MsgType=A) message with the ResetSeqNumFlag (tag=141) flag set.

Declaration
ISession ResetSequenceNumbersViaLogonExchange()
Returns
Type Description
ISession

Send(IMessage)

Sends the given IMessage to the counterparty.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in reply to the Resend Request message when the connection is established and the sequence numbers mismatch is detected.

Warning: it is critical to avoid the message object modification until the method returns control.

Declaration
ISession Send(IMessage message)
Parameters
Type Name Description
IMessage message

Message to send

Returns
Type Description
ISession

Send(SerializedMessage)

Sends the given SerializedMessage to the counterparty.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in reply to the Resend Request message when the connection is established and the sequence numbers mismatch is detected.

Warning: it is critical to avoid the message object modification until the method returns control.

Declaration
ISession Send(SerializedMessage message)
Parameters
Type Name Description
SerializedMessage message

Message to send

Returns
Type Description
ISession

Send(IEnumerable<IMessage>)

Sends messages in a batch to the counterparty.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in reply to the Resend Request message when the connection is established and the sequence numbers mismatch is detected.

Warning: it is critical to avoid the message object modification until the method returns control.

Declaration
ISession Send(IEnumerable<IMessage> messages)
Parameters
Type Name Description
IEnumerable<IMessage> messages

Messages to send

Returns
Type Description
ISession

Send(IEnumerable<SerializedMessage>)

Sends messages in a batch to the counterparty.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in reply to the Resend Request message when the connection is established and the sequence numbers mismatch is detected.

Warning: it is critical to avoid the message object modification until the method returns control.

Declaration
ISession Send(IEnumerable<SerializedMessage> messages)
Parameters
Type Name Description
IEnumerable<SerializedMessage> messages

Messages to send

Returns
Type Description
ISession

SendReject(int, string)

Sends the Reject (MsgType 3) message.

Declaration
ISession SendReject(int refSeqNumber, string text)
Parameters
Type Name Description
int refSeqNumber

The sequence number of the rejected message.

string text

The reject reason text.

Returns
Type Description
ISession

SendResendRequest(int)

Sends the Resend Request (MsgType 2) message.

Normally, the "Resend Request" message is sent automatically. This method allows to simulate a sequence gap by sending this message manually in some venue-specific cases.

Note: This method should not be used in the normal scenarios.

Declaration
ISession SendResendRequest(int beginSeqNumber)
Parameters
Type Name Description
int beginSeqNumber

The sequence number of the first requested message in the range.

Returns
Type Description
ISession

SendTestRequest(string, TimeSpan)

Sends the Test Request (1) message. The method blocks until the heartbeat message is received from the counterparty or timeout ended.

Declaration
ISession SendTestRequest(string testReqId, TimeSpan timeout = default)
Parameters
Type Name Description
string testReqId

The identifier included in Test Request (MsgType 1) message to be returned in resulting Heartbeat (MsgType 0) message from the counterparty

TimeSpan timeout

Maximum interval to wait until the reply is received from the counterparty, 0 if no waiting is required

Returns
Type Description
ISession

Throttle()

Performs throttling of a session that 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.

Declaration
ISession Throttle()
Returns
Type Description
ISession

ThrottlingLimit(int, TimeSpan)

Sets throttling limit parameters.

Declaration
ISession ThrottlingLimit(int messagesCount, TimeSpan interval)
Parameters
Type Name Description
int messagesCount

The message limit per a time unit.

TimeSpan interval

The time interval to limit messages.

Returns
Type Description
ISession

WarmUp(SerializedMessage)

Declaration
ISession WarmUp(SerializedMessage message)
Parameters
Type Name Description
SerializedMessage message
Returns
Type Description
ISession

Events

BytesReceived

Data is received from the network.

Declaration
event BytesReceivedEventHandler BytesReceived
Event Type
Type Description
BytesReceivedEventHandler

Error

Error condition is detected.

Declaration
event EventHandler<SessionErrorEventArgs> Error
Event Type
Type Description
EventHandler<SessionErrorEventArgs>

InboundApplicationMessage

Application-level message is received from the counterparty.

Declaration
event EventHandler<InboundMessageEventArgs> InboundApplicationMessage
Event Type
Type Description
EventHandler<InboundMessageEventArgs>

InboundSessionMessage

Session-level message is received from the counterparty.

Declaration
event EventHandler<InboundMessageEventArgs> InboundSessionMessage
Event Type
Type Description
EventHandler<InboundMessageEventArgs>

MessageResending

Sent application-level message is about to be resent to the counterparty.

Declaration
event EventHandler<MessageResendingEventArgs> MessageResending
Event Type
Type Description
EventHandler<MessageResendingEventArgs>

MessageSending

Message will be sent to the counterparty.

Declaration
event EventHandler<MessageSendingEventArgs> MessageSending
Event Type
Type Description
EventHandler<MessageSendingEventArgs>

OutboundApplicationMessage

Application-level message will be sent to the counterparty.

Declaration
event EventHandler<MessageEventArgs> OutboundApplicationMessage
Event Type
Type Description
EventHandler<MessageEventArgs>

OutboundSessionMessage

Session-level message will be sent to the counterparty.

Declaration
event EventHandler<MessageEventArgs> OutboundSessionMessage
Event Type
Type Description
EventHandler<MessageEventArgs>

ResendingFinished

Resending process is completed.

Declaration
event EventHandler<ResendingStartedFinishedEventArgs> ResendingFinished
Event Type
Type Description
EventHandler<ResendingStartedFinishedEventArgs>

ResendingStarted

ResendRequest (MsgType=2) message is received and the session is about to start resending messages.

Declaration
event EventHandler<ResendingStartedFinishedEventArgs> ResendingStarted
Event Type
Type Description
EventHandler<ResendingStartedFinishedEventArgs>

StateChanged

Session state is changed.

Declaration
event EventHandler<SessionStateChangeEventArgs> StateChanged
Event Type
Type Description
EventHandler<SessionStateChangeEventArgs>

Warning

Warning condition is detected.

Declaration
event EventHandler<SessionWarningEventArgs> Warning
Event Type
Type Description
EventHandler<SessionWarningEventArgs>
In this article
Back to top Copyright © Onix Solutions.
Generated by DocFX