biz.onixs.fix.engine
Class Session

java.lang.Object
  extended by biz.onixs.fix.engine.Session

public class Session
extends Object

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.


Nested Class Summary
static class Session.ErrorArgs
          Error event data.
static interface Session.ErrorListener
          Error event listener.
static class Session.ErrorReason
          Error reason.
static class Session.InboundApplicationMessageArgs
          Inbound application-level message received from the counterparty event data.
static interface Session.InboundApplicationMessageListener
          Inbound application-level message received from the counterparty event listener.
static class Session.InboundSessionMessageArgs
          Inbound session-level message received from the counterparty event data.
static interface Session.InboundSessionMessageListener
          Inbound session-level message received from the counterparty event listener.
static class Session.MessageEventArgs
          Message related event data.
static class Session.MessageResendingArgs
          Message resend request received from the counterparty event data.
static interface Session.MessageResendingListener
          Message resend request received from the counterparty event listener.
static class Session.OutboundApplicationMessageArgs
          Outbound application-level message queued for sending event data.
static interface Session.OutboundApplicationMessageListener
          Outbound application-level message queued for sending event listener.
static class Session.OutboundSessionMessageArgs
          Outbound session-level message queued for sending event data.
static interface Session.OutboundSessionMessageListener
          Outbound session-level message queued for sending event listener.
static class Session.StateChangeArgs
          Session state changed event data.
static interface Session.StateChangeListener
          Session state changed event listener.
static class Session.WarningArgs
          Warning event data.
static interface Session.WarningListener
          Warning event listener.
static class Session.WarningReason
          Warning reason.
 
Field Summary
static Session.ErrorListener NULL_ERROR_LISTENER
           
static Session.InboundApplicationMessageListener NULL_INBOUND_APPLICATION_MESSAGE_LISTENER
           
static Session.InboundSessionMessageListener NULL_INBOUND_SESSION_MESSAGE_LISTENER
           
static Session.MessageResendingListener NULL_MESSAGE_RESENDING_LISTENER
           
static Session.OutboundApplicationMessageListener NULL_OUTBOUND_APPLICATION_MESSAGE_LISTENER
           
static Session.OutboundSessionMessageListener NULL_OUTBOUND_SESSION_MESSAGE_LISTENER
           
static Session.StateChangeListener NULL_STATE_CHANGE_LISTENER
           
static Session.WarningListener NULL_WARNING_LISTENER
           
static int RESEND_REQUEST_MAXIMUM_RANGE_NO_LIMIT
           
 
Constructor Summary
Session(SessionId sessionId)
           
Session(SessionId sessionId, boolean keepSequenceNumbersAfterLogout, SessionStorageType storageType, OutQueue outQueue)
          Creates the FIX Session.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
Session(SessionId sessionId, SessionStorageType storageType, OutQueue outQueue)
          Creates the FIX Session.
The keepSequenceNumbersAfterLogout option to keep sequence numbers after the logout exchange is set to true.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
Session(String senderCompID, String targetCompID, Version version)
          Creates the FIX session.
The keepSequenceNumbersAfterLogout option to keep sequence numbers after the logout exchange is set to true.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.
Session(String senderCompID, String targetCompID, Version version, boolean keepSequenceNumbersAfterLogout)
          Creates the FIX session.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.
Session(String senderCompID, String targetCompID, Version version, boolean keepSequenceNumbersAfterLogout, String token)
          Creates the FIX session.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.
Session(String senderCompID, String targetCompID, Version version, boolean keepSequenceNumbersAfterLogout, String token, boolean cleanStart)
          Creates the FIX Session.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.
Session(String senderCompID, String targetCompID, Version version, boolean keepSequenceNumbersAfterLogout, String token, SessionStorageType storageType)
          Creates the FIX Session.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
Session(String senderCompID, String targetCompID, Version version, SessionStorageType storageType)
          Creates the FIX Session.
The keepSequenceNumbersAfterLogout option to keep sequence numbers after the logout exchange is set to true.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
Session(String senderCompID, String targetCompID, Version version, String token)
          Creates the FIX session.
The keepSequenceNumbersAfterLogout option to keep sequence numbers after the logout exchange is set to true.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.
 
Method Summary
 void breakConnection()
          Breaks the FIX connection non-gracefully (without the exchange of Logout (MsgType=5) messages).
The socket is closed.
 void dispose()
          Explicitly releases resource.
 Message findSentMessage(long messageSequenceNumber)
          Deprecated. Please use getStorage() instead.
 String getCounterpartyHost()
          Returns the counterparty host address.
 int getCounterpartyPort()
          Gets the counterparty port number.
 Session.ErrorListener getErrorListener()
          Returns error listener.
 int getHeartBtInt()
          Returns the Heartbeat interval (seconds, the HeartBtInt (tag=108) field value).
 SessionId getId()
           
 Session.InboundApplicationMessageListener getInboundApplicationMessageListener()
          Returns inbound application message listener.
 MessageFilter getInboundMessageLogFilter()
           
 Session.InboundSessionMessageListener getInboundSessionMessageListener()
          Returns inbound session message listener.
 long getInSeqNum()
          Returns the expected sequence number of the next incoming message.
 boolean getLogInboundMessages()
           
 long getMaxStorageSize()
          Returns the maximum size of the storage in messages.
 Session.MessageResendingListener getMessageResendingListener()
          Returns message resending listener.
 Session.OutboundApplicationMessageListener getOutboundApplicationMessageListener()
          Returns outbound application message listener.
 long getOutboundQueueBytes()
          Returns the total size of messages in the outgoing queue in bytes.
 long getOutboundQueueCount()
          Returns number of messages in the outgoing queue.
 Session.OutboundSessionMessageListener getOutboundSessionMessageListener()
          Returns outbound session message listener.
 long getOutSeqNum()
          Returns the sequence number of the next outgoing message.
 int getReasonableTransmissionTime()
          Returns reasonable transmission time as % from heartbeat interval value.
 int getReceiveBufferSize()
          Returns the size of the TCP socket buffer allocated for receiving data, in bytes.
See also EngineSettings.getConnectionTcpReceiveBufferSize().
 int getResendRequestMaximumRange()
          Returns the maximum number of messages to be requested in one Resend Request (MsgType=2) message.
 SessionRole getRole()
          Returns the session role.
 int getSendBufferSize()
          Returns the size of the TCP socket buffer allocated for sending data, in bytes.
See also EngineSettings.getConnectionTcpSendBufferSize().
 String getSenderCompID()
          Gets the assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages).
 String getSenderLocationID()
          Returns the value of SenderLocationID (142) field that will be set in all outgoing messages.
 String getSenderSubID()
          Returns the value of SenderSubID (50) field that will be set in all outgoing messages.
 SessionState getState()
          Returns session's state.
 Session.StateChangeListener getStateChangeListener()
          Returns state change listener.
 SessionStorage getStorage()
          Returns session storage.
 String getStorageID()
          Returns the id of the session storage.
 String getTargetCompID()
          Assigned value used to identify receiving firm (the TargetCompID (tag=56) field value in outgoing messages).
 String getTargetLocationID()
          Returns the value of TargetLocationID (143) field that will be set in all outgoing messages.
 String getTargetSubID()
          Returns the value of TargetSubID (57) field that will be set in all outgoing messages.
 boolean getTcpNoDelay()
          Tests if TCP_NODELAY socket option is enabled.
 String getToken()
           
 Version getVersion()
          Returns the session FIX version.
 Session.WarningListener getWarningListener()
          Returns warning listener.
 boolean isDisposed()
           
 boolean isSpecifyLastMsgSeqNumProcessed()
          Returns the option to specify the LastMsgSeqNumProcessed (tag # 369) field on every message sent.
 void logonAsAcceptor()
          Establishes FIX Connection as Acceptor.
 void logonAsInitiator(String host, int port)
          Establishes FIX Connection as Initiator using the default heartbeat value.
 void logonAsInitiator(String host, int port, boolean setResetSeqNumFlag)
          Establishes FIX Connection as Initiator.
 void logonAsInitiator(String host, int port, boolean setResetSeqNumFlag, Message customLogonMsg)
          Establishes FIX Connection as Initiator using the custom Logon message.
 void logonAsInitiator(String host, int port, int heartBtInt)
          Establishes FIX Connection as Initiator.
 void logonAsInitiator(String host, int port, int heartBtInt, boolean setResetSeqNumFlag)
          Establishes FIX Connection as Initiator.
 void logonAsInitiator(String host, int port, int heartBtInt, boolean setResetSeqNumFlag, Message customLogonMsg)
          Establishes FIX Connection as Initiator using the custom Logon message.
 void logonAsInitiator(String host, int port, int heartBtInt, Message customLogonMsg)
          Establishes FIX Connection as Initiator using the custom Logon message.
 void logonAsInitiator(String host, int port, Message customLogonMsg)
          Establishes FIX Connection as Initiator using the custom Logon message.
 void logout()
          Terminates the FIX Connection.
 void logout(String text)
          Terminates the FIX Connection.
 void reset()
          Resets the sequence numbers to 1.
 void send(List<Message> messages)
          Puts the messages to the outgoing queue.
 void send(Message message)
          Puts the message to the outgoing queue.
 boolean send(Message message, long timeout, TimeUnit unit)
          Puts the message to the outgoing queue.
 boolean sendNB(List<Message> messages)
          Puts the messages to the outgoing queue.
 boolean sendNB(Message message)
          Puts the message to the outgoing queue.
 void sendTestRequest(String testReqID, long timeoutInMilliseconds)
          Sends the Test Request <1> message.
 void setErrorListener(Session.ErrorListener listener)
          Sets error listener.
Warning.
 void setInboundApplicationMessageFactory(MessageFactory messageFactory)
          Sets message factory to use for creating inbound application message instance.
 void setInboundApplicationMessageListener(Session.InboundApplicationMessageListener listener)
          Sets inbound application message listener.
Warning.
 void setInboundMessageLogFilter(MessageFilter inboundMessageLogFilter)
           
 void setInboundSessionMessageFactory(MessageFactory messageFactory)
          Sets message factory to use for creating inbound session message instance.
 void setInboundSessionMessageListener(Session.InboundSessionMessageListener listener)
          Sets inbound session message listener.
Warning.
 void setInSeqNum(long seqNum)
          Sets the expected sequence number of the next incoming message.
 void setLogInboundMessages(boolean logIncomingMessages)
          Turns on or off the logging of incoming messages.
 void setMaxStorageSize(long maximumSize)
          Sets the maximum size of the storage in messages.
 void setMessageResendingListener(Session.MessageResendingListener listener)
          Sets message resending listener.
Warning.
 void setNetworkInterface(SocketAddress bindAddress)
          Sets the network interface bind address for establishing initiator session.
 void setOutboundApplicationMessageListener(Session.OutboundApplicationMessageListener listener)
          Sets outbound application message listener.
Warning.
 void setOutboundSessionMessageListener(Session.OutboundSessionMessageListener listener)
          Sets outbound session message listener.
Warning.
 void setOutSeqNum(long seqNum)
          Sets the sequence number of the next outgoing message.
 void setReasonableTransmissionTime(int reasonableTransmissionTime)
          Sets reasonable transmission time as % from heartbeat interval value.
 void setReceiveBufferSize(int size)
          Sets the size of the TCP socket buffer allocated for receiving data, in bytes.
See also EngineSettings.setConnectionTcpReceiveBufferSize(int).
 void setResendRequestMaximumRange(int resendRequestMaximumRange)
          Sets the maximum number of messages to be requested in one Resend Request (MsgType=2) message.
 void setSendBufferSize(int sendBufferSize)
          Sets the size of the TCP socket buffer allocated for sending data, in bytes.
See also EngineSettings.setConnectionTcpSendBufferSize(int).
 void setSenderLocationID(String senderLocationID)
          Sets the value of SenderLocationID (142) field that will be set in all outgoing messages.
 void setSenderSubID(String senderSubID)
          Sets the value of SenderSubID (50) field that will be set in all outgoing messages.
 void setSpecifyLastMsgSeqNumProcessed(boolean specifyLastMsgSeqNumProcessed)
          Sets the option to specify the LastMsgSeqNumProcessed (tag # 369) field on every message sent.
 void setSSLContext(SSLContext sslContext)
          Sets the SSL context for establishing secure initiator session.
 void setStateChangeListener(Session.StateChangeListener listener)
          Sets state change listener.
Warning.
 void setTargetLocationID(String targetLocationID)
          Sets the value of TargetLocationID (143) field that will be set in all outgoing messages.
 void setTargetSubID(String targetSubID)
          Sets the value of TargetSubID (57) field that will be set in all outgoing messages.
 void setTcpNoDelay(boolean on)
          Enable/disable TCP_NODELAY socket option (disable/enable Nagle's algorithm).
 void setWarningListener(Session.WarningListener listener)
          Sets warning listener.
Warning.
 String toString()
          Returns a string that represents the current session.
 String toStringDetailed()
           
 boolean useMillisecondsInSendingTimeField()
          Returns 'true' if the milliseconds are set in the SendingTime(52) field, otherwise - 'false'.
 void useMillisecondsInSendingTimeField(boolean useMilliseconds)
          Option to use the milliseconds in the SendingTime(52) field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESEND_REQUEST_MAXIMUM_RANGE_NO_LIMIT

public static final int RESEND_REQUEST_MAXIMUM_RANGE_NO_LIMIT
See Also:
Constant Field Values

NULL_INBOUND_APPLICATION_MESSAGE_LISTENER

public static final Session.InboundApplicationMessageListener NULL_INBOUND_APPLICATION_MESSAGE_LISTENER

NULL_INBOUND_SESSION_MESSAGE_LISTENER

public static final Session.InboundSessionMessageListener NULL_INBOUND_SESSION_MESSAGE_LISTENER

NULL_OUTBOUND_APPLICATION_MESSAGE_LISTENER

public static final Session.OutboundApplicationMessageListener NULL_OUTBOUND_APPLICATION_MESSAGE_LISTENER

NULL_OUTBOUND_SESSION_MESSAGE_LISTENER

public static final Session.OutboundSessionMessageListener NULL_OUTBOUND_SESSION_MESSAGE_LISTENER

NULL_MESSAGE_RESENDING_LISTENER

public static final Session.MessageResendingListener NULL_MESSAGE_RESENDING_LISTENER

NULL_STATE_CHANGE_LISTENER

public static final Session.StateChangeListener NULL_STATE_CHANGE_LISTENER

NULL_WARNING_LISTENER

public static final Session.WarningListener NULL_WARNING_LISTENER

NULL_ERROR_LISTENER

public static final Session.ErrorListener NULL_ERROR_LISTENER
Constructor Detail

Session

public Session(String senderCompID,
               String targetCompID,
               Version version)
Creates the FIX session.
The keepSequenceNumbersAfterLogout option to keep sequence numbers after the logout exchange is set to true.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.

Parameters:
senderCompID - assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages)
targetCompID - assigned value used to identify receiving firm (the TargetCompID (tag=56) field value in outgoing messages)
version - FIX version

Session

public Session(String senderCompID,
               String targetCompID,
               Version version,
               boolean keepSequenceNumbersAfterLogout)
Creates the FIX session.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.

Parameters:
senderCompID - assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages)
targetCompID - assigned value used to identify receiving firm (the TargetCompID (tag=56) field value in outgoing messages)
version - FIX version
keepSequenceNumbersAfterLogout - option to keep sequence numbers after the logout exchange

Session

public Session(String senderCompID,
               String targetCompID,
               Version version,
               String token)
Creates the FIX session.
The keepSequenceNumbersAfterLogout option to keep sequence numbers after the logout exchange is set to true.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.

Parameters:
senderCompID - assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages)
targetCompID - assigned value used to identify receiving firm (the TargetCompID (tag=56) field value in outgoing messages)
version - FIX version
token - session token that is used to distinguish sessions with the same SenderCompID and TargetCompID

Session

public Session(String senderCompID,
               String targetCompID,
               Version version,
               boolean keepSequenceNumbersAfterLogout,
               String token)
Creates the FIX session.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.

Parameters:
senderCompID - assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages)
targetCompID - assigned value used to identify receiving firm (the TargetCompID (tag=56) field value in outgoing messages)
version - FIX version
keepSequenceNumbersAfterLogout - option to keep sequence numbers after the logout exchange
token - Session token that is used to distinguish sessions with the same SenderCompID and TargetCompID

Session

public Session(String senderCompID,
               String targetCompID,
               Version version,
               boolean keepSequenceNumbersAfterLogout,
               String token,
               boolean cleanStart)
Creates the FIX Session.
The storageType session storage type is set to SessionStorageType.FileBasedStorage.

Parameters:
senderCompID - assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages)
targetCompID - assigned value used to identify receiving firm (the TargetCompID (tag=56) field value in outgoing messages)
version - FIX version
keepSequenceNumbersAfterLogout - Option to keep sequence numbers after the logout exchange
token - Session token that is used to distinguish sessions with the same SenderCompID and TargetCompID
cleanStart - option to ignore the previous log files and start the FIX session anew

Session

public Session(String senderCompID,
               String targetCompID,
               Version version,
               SessionStorageType storageType)
Creates the FIX Session.
The keepSequenceNumbersAfterLogout option to keep sequence numbers after the logout exchange is set to true.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.

Parameters:
senderCompID - assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages)
targetCompID - assigned value used to identify receiving firm (the TargetCompID (tag=56) field value in outgoing messages)
version - FIX version
storageType - session storage type

Session

public Session(String senderCompID,
               String targetCompID,
               Version version,
               boolean keepSequenceNumbersAfterLogout,
               String token,
               SessionStorageType storageType)
Creates the FIX Session.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.

Parameters:
senderCompID - assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages)
targetCompID - assigned value used to identify receiving firm (the TargetCompID (tag=56) field value in outgoing messages)
version - FIX version
keepSequenceNumbersAfterLogout - Option to keep sequence numbers after the logout exchange
token - Session token that is used to distinguish sessions with the same SenderCompID and TargetCompID
storageType - session storage type

Session

public Session(SessionId sessionId,
               SessionStorageType storageType,
               OutQueue outQueue)
Creates the FIX Session.
The keepSequenceNumbersAfterLogout option to keep sequence numbers after the logout exchange is set to true.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.

Parameters:
sessionId - session id data
storageType - session storage type
outQueue - outgoing queue implementation

Session

public Session(SessionId sessionId,
               boolean keepSequenceNumbersAfterLogout,
               SessionStorageType storageType,
               OutQueue outQueue)
Creates the FIX Session.
The cleanStart option to ignore the previous log files and start the FIX session anew is set to false.

Parameters:
sessionId - session id data
keepSequenceNumbersAfterLogout - Option to keep sequence numbers after the logout exchange
storageType - session storage type
outQueue - outgoing queue implementation

Session

public Session(SessionId sessionId)
Method Detail

getId

public SessionId getId()

breakConnection

public void breakConnection()
Breaks the FIX connection non-gracefully (without the exchange of Logout (MsgType=5) messages).
The socket is closed. The state is changed to SessionState.DISCONNECTED.


logonAsAcceptor

public void 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.


getTcpNoDelay

public boolean getTcpNoDelay()
Tests if TCP_NODELAY socket option is enabled.


setMaxStorageSize

public void setMaxStorageSize(long maximumSize)
Sets the maximum size of the storage in messages.

Parameters:
maximumSize - maximum size of the message storage

getMaxStorageSize

public long getMaxStorageSize()
Returns the maximum size of the storage in messages.

Returns:
maximum size of the message storage

setTcpNoDelay

public void setTcpNoDelay(boolean on)
Enable/disable TCP_NODELAY socket option (disable/enable Nagle's algorithm).

Parameters:
on - true to enable TCP_NODELAY, false to disable.

logonAsInitiator

public void logonAsInitiator(String host,
                             int port)
Establishes FIX Connection as Initiator using the default heartbeat value.

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

Parameters:
host - Counterparty's host name or address
port - Counterparty's port number
Throws:
EngineException - The FIX Connection cannot be established

logonAsInitiator

public void logonAsInitiator(String host,
                             int port,
                             boolean setResetSeqNumFlag)
Establishes FIX Connection as Initiator.

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

Parameters:
host - Counterparty's host name or address
port - Counterparty's port number
setResetSeqNumFlag - Option to set the ResetSeqNumFlag(141) in the initial Logon(A) message.
Throws:
EngineException - The FIX Connection cannot be established

logonAsInitiator

public void logonAsInitiator(String host,
                             int port,
                             int heartBtInt,
                             boolean setResetSeqNumFlag)
Establishes FIX Connection as Initiator.

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

Parameters:
host - Counterparty's host name or address
port - Counterparty's port number
heartBtInt - Heartbeat interval (seconds)
setResetSeqNumFlag - Option to set the ResetSeqNumFlag(141) in the initial Logon(A) message.
Throws:
EngineException - The FIX Connection cannot be established

logonAsInitiator

public void logonAsInitiator(String host,
                             int port,
                             int heartBtInt)
Establishes FIX Connection as Initiator.

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

Parameters:
host - Counterparty's host name or address
port - Counterparty's port number
heartBtInt - Heartbeat interval (seconds)
Throws:
EngineException - The FIX Connection cannot be established

logonAsInitiator

public void logonAsInitiator(String host,
                             int port,
                             Message customLogonMsg)
Establishes FIX Connection as Initiator using the custom Logon message.

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

Parameters:
host - Counterparty's host name or address
port - Counterparty's port number
customLogonMsg - Custom Logon message
Throws:
EngineException - The FIX Connection cannot be established

logonAsInitiator

public void logonAsInitiator(String host,
                             int port,
                             int heartBtInt,
                             boolean setResetSeqNumFlag,
                             Message customLogonMsg)
Establishes FIX Connection as Initiator using the custom Logon message.

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

Parameters:
host - Counterparty's host name or address
port - Counterparty's port number
heartBtInt - Heartbeat interval (seconds)
setResetSeqNumFlag - Option to set the ResetSeqNumFlag(141) in the initial Logon(A) message.
customLogonMsg - Custom Logon message
Throws:
EngineException - The FIX Connection cannot be established

logonAsInitiator

public void logonAsInitiator(String host,
                             int port,
                             boolean setResetSeqNumFlag,
                             Message customLogonMsg)
Establishes FIX Connection as Initiator using the custom Logon message.

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

Parameters:
host - Counterparty's host name or address
port - Counterparty's port number
setResetSeqNumFlag - Option to set the ResetSeqNumFlag(141) in the initial Logon(A) message.
customLogonMsg - Custom Logon message
Throws:
EngineException - The FIX Connection cannot be established

logonAsInitiator

public void logonAsInitiator(String host,
                             int port,
                             int heartBtInt,
                             Message customLogonMsg)
Establishes FIX Connection as Initiator using the custom Logon message.

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

Parameters:
host - Counterparty's host name or address
port - Counterparty's port number
heartBtInt - Heartbeat interval (seconds)
customLogonMsg - Custom Logon message
Throws:
EngineException - The FIX Connection cannot be established

logout

public void logout()
Terminates the FIX Connection.

The initial Logout message is sent to the counterparty and the method blocks until the acknowledgement Logout message is received.


logout

public void logout(String text)
Terminates the FIX Connection.

The initial Logout message is sent to the counterparty and the method blocks until the acknowledgement Logout message is received.

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

reset

public void reset()
Resets the sequence numbers to 1. This method can be called only when the session is disconnected.


send

public void send(Message message)
Puts the message to the outgoing queue. This method blocks if the outgoing queue is full.
If the session is not established, the message will be sent when the connection is established.
Warning. It is critical to avoid message object modification until method returns control.

Parameters:
message - message to send
Throws:
NullPointerException - if message is null
EngineException - if error occurs

sendNB

public boolean sendNB(Message message)
Puts the message to the outgoing queue. If the outgoing queue is full then this method doesn't block and message is not sent.
If the session is not established, the message will be sent when the connection is established.
Warning. It is critical to avoid message object modification until method returns control.

Parameters:
message - message to send
Returns:
whether message is put to the outgoing queue or not
Throws:
NullPointerException - if message is null
EngineException - if error occurs

send

public boolean send(Message message,
                    long timeout,
                    TimeUnit unit)
Puts the message to the outgoing queue. If the outgoing queue is full then this method waits for space to become available during timeout.
If the session is not established, the message will be sent when the connection is established.
Warning. It is critical to avoid message object modification until method returns control.

Parameters:
message - message to send
timeout - how long to wait before giving up, in units of unit
unit - determines how to interpret the timeout parameter
Returns:
whether message is put to the outgoing queue or not
Throws:
NullPointerException - if message or unit is null
EngineException - if error occurs

send

public void send(List<Message> messages)
Puts the messages to the outgoing queue. This method blocks if the outgoing queue is full.
If the session is not established, the messages will be sent when the connection is established.
Warning. It is critical to avoid message objects modification until method returns control.

Parameters:
messages - messages to send
Throws:
NullPointerException - if messages is null
IllegalArgumentException - if messages is empty
EngineException - if error occurs

sendNB

public boolean sendNB(List<Message> messages)
Puts the messages to the outgoing queue. If the outgoing queue is full then this method doesn't block and messages are not sent.
If the session is not established, the messages will be sent when the connection is established.
Warning. It is critical to avoid message objects modification until method returns control.

Parameters:
messages - messages to send
Returns:
whether messages are put to the outgoing queue or not
Throws:
NullPointerException - if messages is null
IllegalArgumentException - if messages is empty
EngineException - if error occurs

sendTestRequest

public void sendTestRequest(String testReqID,
                            long timeoutInMilliseconds)
                     throws EngineException
Sends the Test Request <1> message. Waits at most timeoutInMilliseconds until the reply is received from the counterparty.

Parameters:
testReqID - identifier included in Test Request <1> message to be returned in resulting Heartbeat (0) message from the counterparty
timeoutInMilliseconds - The maximum interval to wait until the reply is received from the counterparty.
Throws:
EngineException

getInboundApplicationMessageListener

public Session.InboundApplicationMessageListener getInboundApplicationMessageListener()
Returns inbound application message listener.

Returns:
inbound application message listener

setInboundApplicationMessageListener

public void setInboundApplicationMessageListener(Session.InboundApplicationMessageListener listener)
Sets inbound application message listener.
Warning. This is critical to avoid time-consuming tasks inside the listener.

Parameters:
listener - inbound application message listener or NULL_INBOUND_APPLICATION_MESSAGE_LISTENER value to reset listener to default

getInboundSessionMessageListener

public Session.InboundSessionMessageListener getInboundSessionMessageListener()
Returns inbound session message listener.

Returns:
inbound session message listener

setInboundSessionMessageListener

public void setInboundSessionMessageListener(Session.InboundSessionMessageListener listener)
Sets inbound session message listener.
Warning. This is critical to avoid time-consuming tasks inside the listener.

Parameters:
listener - inbound session message listener or NULL_INBOUND_SESSION_MESSAGE_LISTENER value to reset listener to default

getOutboundApplicationMessageListener

public Session.OutboundApplicationMessageListener getOutboundApplicationMessageListener()
Returns outbound application message listener.

Returns:
outbound application message listener

setOutboundApplicationMessageListener

public void setOutboundApplicationMessageListener(Session.OutboundApplicationMessageListener listener)
Sets outbound application message listener.
Warning. This is critical to avoid time-consuming tasks inside the listener.

Parameters:
listener - outbound application message listener or NULL_OUTBOUND_APPLICATION_MESSAGE_LISTENER value to reset listener to default

getOutboundSessionMessageListener

public Session.OutboundSessionMessageListener getOutboundSessionMessageListener()
Returns outbound session message listener.

Returns:
outbound session message listener

setOutboundSessionMessageListener

public void setOutboundSessionMessageListener(Session.OutboundSessionMessageListener listener)
Sets outbound session message listener.
Warning. This is critical to avoid time-consuming tasks inside the listener.

Parameters:
listener - outbound session message listener or NULL_OUTBOUND_SESSION_MESSAGE_LISTENER value to reset listener to default

getMessageResendingListener

public Session.MessageResendingListener getMessageResendingListener()
Returns message resending listener.

Returns:
message resending listener

setMessageResendingListener

public void setMessageResendingListener(Session.MessageResendingListener listener)
Sets message resending listener.
Warning. This is critical to avoid time-consuming tasks inside the listener.

Parameters:
listener - message resending listener or NULL_MESSAGE_RESENDING_LISTENER value to reset listener to default

getErrorListener

public Session.ErrorListener getErrorListener()
Returns error listener.

Returns:
error listener

setErrorListener

public void setErrorListener(Session.ErrorListener listener)
Sets error listener.
Warning. This is critical to avoid time-consuming tasks inside the listener.

Parameters:
listener - error listener or NULL_ERROR_LISTENER value to reset listener to default

getWarningListener

public Session.WarningListener getWarningListener()
Returns warning listener.

Returns:
warning listener

setWarningListener

public void setWarningListener(Session.WarningListener listener)
Sets warning listener.
Warning. This is critical to avoid time-consuming tasks inside the listener.

Parameters:
listener - warning listener or NULL_WARNING_LISTENER value to reset listener to default

getStateChangeListener

public Session.StateChangeListener getStateChangeListener()
Returns state change listener.

Returns:
state change listener

setStateChangeListener

public void setStateChangeListener(Session.StateChangeListener listener)
Sets state change listener.
Warning. This is critical to avoid time-consuming tasks inside the listener.

Parameters:
listener - state change listener or NULL_STATE_CHANGE_LISTENER value to reset listener to default

getCounterpartyHost

public String getCounterpartyHost()
Returns the counterparty host address.

Returns:
Counterparty host

getCounterpartyPort

public int getCounterpartyPort()
Gets the counterparty port number.

Returns:
Counterparty port

getHeartBtInt

public int getHeartBtInt()
Returns the Heartbeat interval (seconds, the HeartBtInt (tag=108) field value).

Returns:
Heartbeat interval (seconds)

getInSeqNum

public long getInSeqNum()
Returns the expected sequence number of the next incoming message.

Returns:
sequence number

setInSeqNum

public void setInSeqNum(long seqNum)
Sets the expected sequence number of the next incoming message.

Parameters:
seqNum - sequence number

useMillisecondsInSendingTimeField

public boolean useMillisecondsInSendingTimeField()
Returns 'true' if the milliseconds are set in the SendingTime(52) field, otherwise - 'false'.


useMillisecondsInSendingTimeField

public void useMillisecondsInSendingTimeField(boolean useMilliseconds)
Option to use the milliseconds in the SendingTime(52) field.


setSpecifyLastMsgSeqNumProcessed

public void setSpecifyLastMsgSeqNumProcessed(boolean specifyLastMsgSeqNumProcessed)
Sets the option to specify the LastMsgSeqNumProcessed (tag # 369) field on every message sent.

Parameters:
specifyLastMsgSeqNumProcessed - whether to specify the LastMsgSeqNumProcessed

isSpecifyLastMsgSeqNumProcessed

public boolean isSpecifyLastMsgSeqNumProcessed()
Returns the option to specify the LastMsgSeqNumProcessed (tag # 369) field on every message sent.

Returns:
option to specify the LastMsgSeqNumProcessed

getOutSeqNum

public long getOutSeqNum()
Returns the sequence number of the next outgoing message.

Returns:
sequence number

setOutSeqNum

public void setOutSeqNum(long seqNum)
Sets the sequence number of the next outgoing message.

Parameters:
seqNum - sequence number

getSenderSubID

public String getSenderSubID()
Returns the value of SenderSubID (50) field that will be set in all outgoing messages.

Returns:
SenderSubID (50) field value.

setSenderSubID

public void setSenderSubID(String senderSubID)
Sets the value of SenderSubID (50) field that will be set in all outgoing messages.

Parameters:
senderSubID - SenderSubID (50) field value.

getTargetSubID

public String getTargetSubID()
Returns the value of TargetSubID (57) field that will be set in all outgoing messages.

Returns:
TargetSubID (57) field value.

setTargetSubID

public void setTargetSubID(String targetSubID)
Sets the value of TargetSubID (57) field that will be set in all outgoing messages.

Parameters:
targetSubID - TargetSubID (57) field value.

getSenderLocationID

public String getSenderLocationID()
Returns the value of SenderLocationID (142) field that will be set in all outgoing messages.

Returns:
SenderLocationID (142) field value.

setSenderLocationID

public void setSenderLocationID(String senderLocationID)
Sets the value of SenderLocationID (142) field that will be set in all outgoing messages.

Parameters:
senderLocationID - SenderLocationID (142) field value.

getTargetLocationID

public String getTargetLocationID()
Returns the value of TargetLocationID (143) field that will be set in all outgoing messages.

Returns:
TargetLocationID (143) field value.

setTargetLocationID

public void setTargetLocationID(String targetLocationID)
Sets the value of TargetLocationID (143) field that will be set in all outgoing messages.

Parameters:
targetLocationID - TargetLocationID (143) field value.

getStorage

public SessionStorage getStorage()
Returns session storage.

Returns:
session storage

getStorageID

public String getStorageID()
Returns the id of the session storage.

Returns:
session storage id

getRole

public SessionRole getRole()
Returns the session role.

Returns:
Session role

getSenderCompID

public String getSenderCompID()
Gets the assigned value used to identify firm sending message (the SenderCompID (tag=49) field value in outgoing messages).

Returns:
SenderCompID

getTargetCompID

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

Returns:
TargetCompID

getToken

public String getToken()
Returns:
Session token.

getVersion

public Version getVersion()
Returns the session FIX version.

Returns:
FIX version

getState

public SessionState getState()
Returns session's state.

Returns:
session state

getLogInboundMessages

public boolean getLogInboundMessages()
Returns:
true if incoming messages are logged, otherwise - false.

setLogInboundMessages

public void setLogInboundMessages(boolean logIncomingMessages)
Turns on or off the logging of incoming messages.

Parameters:
logIncomingMessages - Option to log inbound messages.

toString

public String toString()
Returns a string that represents the current session.

Overrides:
toString in class Object
Returns:
session description string

toStringDetailed

public String toStringDetailed()

dispose

public void dispose()
Explicitly releases resource.


setSSLContext

public void setSSLContext(SSLContext sslContext)
Sets the SSL context for establishing secure initiator session.

Parameters:
sslContext - SSL context

setNetworkInterface

public void setNetworkInterface(SocketAddress bindAddress)
Sets the network interface bind address for establishing initiator session.

Parameters:
bindAddress - bind address

setInboundApplicationMessageFactory

public void setInboundApplicationMessageFactory(MessageFactory messageFactory)
Sets message factory to use for creating inbound application message instance.

Parameters:
messageFactory - message factory

setInboundSessionMessageFactory

public void setInboundSessionMessageFactory(MessageFactory messageFactory)
Sets message factory to use for creating inbound session message instance.

Parameters:
messageFactory - message factory

getInboundMessageLogFilter

public MessageFilter getInboundMessageLogFilter()

setInboundMessageLogFilter

public void setInboundMessageLogFilter(MessageFilter inboundMessageLogFilter)

getOutboundQueueBytes

public long getOutboundQueueBytes()
Returns the total size of messages in the outgoing queue in bytes.

Returns:
total size of messages in bytes

getOutboundQueueCount

public long getOutboundQueueCount()
Returns number of messages in the outgoing queue.

Returns:
number of messages

setReceiveBufferSize

public void setReceiveBufferSize(int size)
Sets the size of the TCP socket buffer allocated for receiving data, in bytes.
See also EngineSettings.setConnectionTcpReceiveBufferSize(int).

Parameters:
size - TCP socket receive buffer size

getReceiveBufferSize

public int getReceiveBufferSize()
Returns the size of the TCP socket buffer allocated for receiving data, in bytes.
See also EngineSettings.getConnectionTcpReceiveBufferSize().

Returns:
TCP socket receive buffer size

setSendBufferSize

public void setSendBufferSize(int sendBufferSize)
Sets the size of the TCP socket buffer allocated for sending data, in bytes.
See also EngineSettings.setConnectionTcpSendBufferSize(int).

Parameters:
sendBufferSize - TCP socket send buffer size

getSendBufferSize

public int getSendBufferSize()
Returns the size of the TCP socket buffer allocated for sending data, in bytes.
See also EngineSettings.getConnectionTcpSendBufferSize().

Returns:
TCP socket send buffer size

setReasonableTransmissionTime

public void setReasonableTransmissionTime(int reasonableTransmissionTime)
Sets reasonable transmission time as % from heartbeat interval value.

Parameters:
reasonableTransmissionTime - reasonable transmission time

getReasonableTransmissionTime

public int getReasonableTransmissionTime()
Returns reasonable transmission time as % from heartbeat interval value.

Returns:
reasonable transmission time

findSentMessage

public Message findSentMessage(long messageSequenceNumber)
Deprecated. Please use getStorage() instead.

Returns the sent message if it can be found by the given message sequence number, otherwise - null.

Parameters:
messageSequenceNumber - message sequence number
Returns:
message or null
Throws:
IllegalArgumentException - if messageSequenceNumber < 1

setResendRequestMaximumRange

public void setResendRequestMaximumRange(int resendRequestMaximumRange)
Sets the maximum number of messages to be requested in one Resend Request (MsgType=2) message.

Parameters:
resendRequestMaximumRange - maximum number of messages to be requested in one Resend Request or RESEND_REQUEST_MAXIMUM_RANGE_NO_LIMIT for no limit
Throws:
IllegalArgumentException - if resendRequestMaximumRange < 0

getResendRequestMaximumRange

public int getResendRequestMaximumRange()
Returns the maximum number of messages to be requested in one Resend Request (MsgType=2) message.

Returns:
maximum number of messages to be requested in one Resend Request or RESEND_REQUEST_MAXIMUM_RANGE_NO_LIMIT for no limit

isDisposed

public boolean isDisposed()


Copyright © 2005-2012 Onix Solutions. All Rights Reserved.