quickfix
Class Session

java.lang.Object
  extended by quickfix.Session

public class Session
extends java.lang.Object

The Session is the primary FIX abstraction for message communication. It performs sequencing and error recovery and represents an communication channel to a counterparty. Sessions are independent of specific communication layer connections. A Session is defined as starting with message sequence number of 1 and ending when the session is reset. The Sesion could span many sequential connections (it cannot operate on multiple connection simultaneously).


Field Summary
static int DEFAULT_MAX_LATENCY
           
static double DEFAULT_TEST_REQUEST_DELAY_MULTIPLIER
           
protected static org.slf4j.Logger log
           
static java.lang.String REJECT_INVALID_MESSAGE
          Allow to ignore heart beat message
static java.lang.String SETTING_ALLOW_UNKNOWN_MSG_FIELDS
          Allow unknown fields in messages.
static java.lang.String SETTING_APP_DATA_DICTIONARY
          Session setting specifying the path to the application data dictionary to use for this session.
static java.lang.String SETTING_CHECK_COMP_ID
          If set to Y, messages must be received from the counterparty with the correct SenderCompID and TargetCompID.
static java.lang.String SETTING_CHECK_GAP_FIELD_ON_ADMIN_MESSAGE
          Allow to disable gap field check on administrative message.
static java.lang.String SETTING_CHECK_LATENCY
          Session setting for enabling message latency checks.
static java.lang.String SETTING_DATA_DICTIONARY
          Session setting specifying the path to the data dictionary to use for this session.
static java.lang.String SETTING_DEFAULT_APPL_VER_ID
           
static java.lang.String SETTING_DESCRIPTION
          Session description.
static java.lang.String SETTING_DISABLE_HEART_BEAT_CHECK
          Allow to disable heart beat failure detection
static java.lang.String SETTING_DISCONNECT_ON_ERROR
          Session setting for doing an automatic disconnect when an error occurs.
static java.lang.String SETTING_END_DAY
          Session scheduling setting to specify last day of trading week.
static java.lang.String SETTING_END_TIME
          Session scheduling setting to specify end time of the trading day.
static java.lang.String SETTING_FORCE_RESEND_WHEN_CORRUPTED_STORE
           
static java.lang.String SETTING_FORCE_RESYNC
          When logout response contains "expecting XXX", the sequence numbers of forcibly resynchronized.
static java.lang.String SETTING_HEARTBTINT
          Session setting for heartbeat interval (in seconds).
static java.lang.String SETTING_LOGON_TIMEOUT
          Session setting for logon timeout (in seconds).
static java.lang.String SETTING_LOGOUT_TIMEOUT
          Session setting for logout timeout (in seconds).
static java.lang.String SETTING_MAX_LATENCY
          Session setting for maximum message latency (in seconds).
static java.lang.String SETTING_MILLISECONDS_IN_TIMESTAMP
          Session setting to enable milliseconds in message timestamps.
static java.lang.String SETTING_NON_STOP_SESSION
          Session scheduling setting to specify that session never reset
static java.lang.String SETTING_PERSIST_MESSAGES
          Persist messages setting (true, by default).
static java.lang.String SETTING_REFRESH_ON_LOGON
          Requests that state and message data be refreshed from the message store at logon, if possible.
static java.lang.String SETTING_RESET_ON_DISCONNECT
          Session setting for doing an automatic sequence number reset on disconnect.
static java.lang.String SETTING_RESET_ON_ERROR
          Session setting for doing an automatic reset when an error occurs.
static java.lang.String SETTING_RESET_ON_LOGON
          Session setting that causes the session to reset sequence numbers when initiating a logon (>= FIX 4.2).
static java.lang.String SETTING_RESET_ON_LOGOUT
          Session setting for doing an automatic sequence number reset on logout.
static java.lang.String SETTING_SEND_REDUNDANT_RESEND_REQUEST
          Configures the session to send redundant resend requests (off, by default).
static java.lang.String SETTING_START_DAY
          Session scheduling setting to specify first day of trading week.
static java.lang.String SETTING_START_TIME
          Session scheduling setting to specify starting time of the trading day.
static java.lang.String SETTING_TEST_REQUEST_DELAY_MULTIPLIER
          Session setting for the test delay multiplier (0-1, as fraction of Heartbeat interval)
static java.lang.String SETTING_TIMEZONE
          Session scheduling setting to specify time zone for the session.
static java.lang.String SETTING_TRANSPORT_DATA_DICTIONARY
          Session setting specifying the path to the transport data dictionary.
static java.lang.String SETTING_USE_DATA_DICTIONARY
          Session setting to indicate whether a data dictionary should be used.
static java.lang.String SETTING_VALIDATE_FIELDS_HAVE_VALUES
          Session validation setting for enabling whether field values are validated.
static java.lang.String SETTING_VALIDATE_FIELDS_OUT_OF_ORDER
          Session validation setting for enabling whether field ordering is validated.
static java.lang.String SETTING_VALIDATE_USER_DEFINED_FIELDS
          Controls validation of user-defined fields.
static java.lang.String USE_CLOSED_RESEND_INTERVAL
          Use actual end of sequence gap for resend requests rather than using "infinity" as the end sequence of the gap.
 
Method Summary
 void addStateListener(SessionStateListener listener)
           
 void disconnect()
          Deprecated.  
 void disconnect(java.lang.String reason, boolean logError)
          Logs out from session and closes the network connection.
static boolean doesSessionExist(SessionID sessionID)
          Determine if a session exists with the given ID.
protected static java.lang.Integer extractExpectedSequenceNumber(java.lang.String txt)
           
 boolean getCheckCompID()
           
 DataDictionary getDataDictionary()
           
 DataDictionaryProvider getDataDictionaryProvider()
           
 int getExpectedSenderNum()
          Retrieves the expected sender sequence number.
 int getExpectedTargetNum()
          Retrieves the expected target sequence number.
 Log getLog()
           
 int getLogonTimeout()
           
 int getLogoutTimeout()
           
 MessageFactory getMessageFactory()
           
 boolean getRedundantResentRequestsAllowed()
           
 boolean getRefreshOnLogon()
           
 boolean getResetOnDisconnect()
           
 boolean getResetOnLogout()
           
 Responder getResponder()
           
 ApplVerID getSenderDefaultApplicationVersionID()
           
 SessionID getSessionID()
           
 java.util.Date getStartTime()
           
 MessageStore getStore()
          Get the message store.
 ApplVerID getTargetDefaultApplicationVersionID()
           
 double getTestRequestDelayMultiplier()
           
 boolean hasResponder()
          This should not be used by end users.
 boolean isCheckGapFieldOnAdminMessage()
           
 boolean isEnabled()
          Used internally by initiator implementation.
 boolean isLoggedOn()
          Is the session logged on.
 boolean isLogonAlreadySent()
           
 boolean isLogonReceived()
           
 boolean isLogonSendNeeded()
           
 boolean isLogonSent()
           
 boolean isLogonTimedOut()
           
 boolean isLogoutReceived()
           
 boolean isLogoutSent()
           
 boolean isLogoutTimedOut()
           
 boolean isSessionTime()
          Predicate for determining if the session should be active at the current time.
 boolean isUsingDataDictionary()
           
 void logon()
          This method can be used to manually logon to a FIX session.
 void logout()
          This method can be used to manually logout of a FIX session.
 void logout(java.lang.String reason)
          This method can be used to manually logout of a FIX session.
static Session lookupSession(SessionID sessionID)
          Locates a session specified by the provided session ID.
 void next()
          Called from the timer-related code in the acceptor/initiator implementations.
 void next(Message message)
          (Internal use only)
static int numSessions()
          Return the session count.
 boolean receivedLogon()
          Predicate indicating whether a logon message has been received.
 boolean receivedLogout()
          Predicate indicating whether a logout message has been received.
 void removeStateListener(SessionStateListener listener)
           
 void reset()
          Logouts and disconnects session and then resets session state.
 boolean send(Message message)
          Send a message to a counterparty.
static boolean sendToTarget(Message message)
          Send a message to the session specified in the message's target identifiers.
static boolean sendToTarget(Message message, SessionID sessionID)
          Send a message to the session specified by the provided session ID.
static boolean sendToTarget(Message message, java.lang.String qualifier)
          Send a message to the session specified in the message's target identifiers.
static boolean sendToTarget(Message message, java.lang.String senderCompID, java.lang.String targetCompID)
          Send a message to the session specified by the provided target company ID.
static boolean sendToTarget(Message message, java.lang.String senderCompID, java.lang.String targetCompID, java.lang.String qualifier)
          Send a message to the session specified by the provided target company ID.
 boolean sentLogon()
          Predicate indicating whether a logon message has been sent.
 boolean sentLogout()
          Predicate indicating whether a logout message has been sent.
 void setCheckGapFieldOnAdminMessage(boolean checkGapFieldOnAdminMessage)
           
 void setDataDictionary(DataDictionary dataDictionary)
          Deprecated.  
 void setForceResendWhenCorruptedStore(boolean forceResendWhenCorruptedStore)
           
 void setHeartBeatInterval(int heartbeatInterval)
          Internal use by acceptor code.
 void setIgnoreHeartBeatFailure(boolean ignoreHeartBeatFailure)
           
 void setLogonTimeout(int seconds)
          Sets the timeout for waiting for a logon response.
 void setLogoutTimeout(int seconds)
          Sets the timeout for waiting for a logout response.
 void setNextSenderMsgSeqNum(int num)
          Set the next outgoing message sequence number.
 void setNextTargetMsgSeqNum(int num)
          Set the next expected target message sequence number.
 void setRejectInvalidMessage(boolean RejectInvalidMessage)
           
 void setResponder(Responder responder)
          Registers a responder with the session.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SETTING_HEARTBTINT

public static final java.lang.String SETTING_HEARTBTINT
Session setting for heartbeat interval (in seconds).

See Also:
Constant Field Values

SETTING_CHECK_LATENCY

public static final java.lang.String SETTING_CHECK_LATENCY
Session setting for enabling message latency checks. Values are "Y" or "N".

See Also:
Constant Field Values

SETTING_CHECK_COMP_ID

public static final java.lang.String SETTING_CHECK_COMP_ID
If set to Y, messages must be received from the counterparty with the correct SenderCompID and TargetCompID. Some systems will send you different CompIDs by design, so you must set this to N.

See Also:
Constant Field Values

SETTING_MAX_LATENCY

public static final java.lang.String SETTING_MAX_LATENCY
Session setting for maximum message latency (in seconds).

See Also:
Constant Field Values

SETTING_TEST_REQUEST_DELAY_MULTIPLIER

public static final java.lang.String SETTING_TEST_REQUEST_DELAY_MULTIPLIER
Session setting for the test delay multiplier (0-1, as fraction of Heartbeat interval)

See Also:
Constant Field Values

SETTING_NON_STOP_SESSION

public static final java.lang.String SETTING_NON_STOP_SESSION
Session scheduling setting to specify that session never reset

See Also:
Constant Field Values

SETTING_START_DAY

public static final java.lang.String SETTING_START_DAY
Session scheduling setting to specify first day of trading week.

See Also:
Constant Field Values

SETTING_END_DAY

public static final java.lang.String SETTING_END_DAY
Session scheduling setting to specify last day of trading week.

See Also:
Constant Field Values

SETTING_TIMEZONE

public static final java.lang.String SETTING_TIMEZONE
Session scheduling setting to specify time zone for the session.

See Also:
Constant Field Values

SETTING_START_TIME

public static final java.lang.String SETTING_START_TIME
Session scheduling setting to specify starting time of the trading day.

See Also:
Constant Field Values

SETTING_END_TIME

public static final java.lang.String SETTING_END_TIME
Session scheduling setting to specify end time of the trading day.

See Also:
Constant Field Values

SETTING_USE_DATA_DICTIONARY

public static final java.lang.String SETTING_USE_DATA_DICTIONARY
Session setting to indicate whether a data dictionary should be used. If a data dictionary is not used then message validation is not possble.

See Also:
Constant Field Values

SETTING_DATA_DICTIONARY

public static final java.lang.String SETTING_DATA_DICTIONARY
Session setting specifying the path to the data dictionary to use for this session. This setting supports the possibility of a custom data dictionary for each session. Normally, the default data dictionary for a specific FIX version will be specified.

See Also:
Constant Field Values

SETTING_TRANSPORT_DATA_DICTIONARY

public static final java.lang.String SETTING_TRANSPORT_DATA_DICTIONARY
Session setting specifying the path to the transport data dictionary. This setting supports the possibility of a custom transport data dictionary for each session. This setting would only be used with FIXT 1.1 and new transport protocols.

See Also:
Constant Field Values

SETTING_APP_DATA_DICTIONARY

public static final java.lang.String SETTING_APP_DATA_DICTIONARY
Session setting specifying the path to the application data dictionary to use for this session. This setting supports the possibility of a custom application data dictionary for each session. This setting would only be used with FIXT 1.1 and new transport protocols. This setting can be used as a prefix to specify multiple application dictionaries for the FIXT transport. For example:

 DefaultApplVerID=FIX.4.2
 AppDataDictionary=FIX42.xml
 AppDataDictionary.FIX.4.4=FIX44.xml
 
This would use FIX42.xml for the default application version ID and FIX44.xml for any FIX 4.4 messages.

See Also:
Constant Field Values

SETTING_VALIDATE_FIELDS_OUT_OF_ORDER

public static final java.lang.String SETTING_VALIDATE_FIELDS_OUT_OF_ORDER
Session validation setting for enabling whether field ordering is validated. Values are "Y" or "N". Default is "Y".

See Also:
Constant Field Values

SETTING_VALIDATE_FIELDS_HAVE_VALUES

public static final java.lang.String SETTING_VALIDATE_FIELDS_HAVE_VALUES
Session validation setting for enabling whether field values are validated. Empty fields values are not allowed. Values are "Y" or "N". Default is "Y".

See Also:
Constant Field Values

SETTING_LOGON_TIMEOUT

public static final java.lang.String SETTING_LOGON_TIMEOUT
Session setting for logon timeout (in seconds).

See Also:
Constant Field Values

SETTING_LOGOUT_TIMEOUT

public static final java.lang.String SETTING_LOGOUT_TIMEOUT
Session setting for logout timeout (in seconds).

See Also:
Constant Field Values

SETTING_RESET_ON_LOGOUT

public static final java.lang.String SETTING_RESET_ON_LOGOUT
Session setting for doing an automatic sequence number reset on logout. Valid values are "Y" or "N". Default is "N".

See Also:
Constant Field Values

SETTING_FORCE_RESYNC

public static final java.lang.String SETTING_FORCE_RESYNC
When logout response contains "expecting XXX", the sequence numbers of forcibly resynchronized. Valid values are "Y" or "N". Default is "N".

See Also:
Constant Field Values

SETTING_RESET_ON_DISCONNECT

public static final java.lang.String SETTING_RESET_ON_DISCONNECT
Session setting for doing an automatic sequence number reset on disconnect. Valid values are "Y" or "N". Default is "N".

See Also:
Constant Field Values

SETTING_RESET_ON_ERROR

public static final java.lang.String SETTING_RESET_ON_ERROR
Session setting for doing an automatic reset when an error occurs. Valid values are "Y" or "N". Default is "N". A reset means disconnect, sequence numbers reset, store cleaned and reconnect, as for a daily reset.

See Also:
Constant Field Values

SETTING_DISCONNECT_ON_ERROR

public static final java.lang.String SETTING_DISCONNECT_ON_ERROR
Session setting for doing an automatic disconnect when an error occurs. Valid values are "Y" or "N". Default is "N".

See Also:
Constant Field Values

SETTING_MILLISECONDS_IN_TIMESTAMP

public static final java.lang.String SETTING_MILLISECONDS_IN_TIMESTAMP
Session setting to enable milliseconds in message timestamps. Valid values are "Y" or "N". Default is "Y". Only valid for FIX version >= 4.2.

See Also:
Constant Field Values

SETTING_VALIDATE_USER_DEFINED_FIELDS

public static final java.lang.String SETTING_VALIDATE_USER_DEFINED_FIELDS
Controls validation of user-defined fields.

See Also:
Constant Field Values

SETTING_RESET_ON_LOGON

public static final java.lang.String SETTING_RESET_ON_LOGON
Session setting that causes the session to reset sequence numbers when initiating a logon (>= FIX 4.2).

See Also:
Constant Field Values

SETTING_DESCRIPTION

public static final java.lang.String SETTING_DESCRIPTION
Session description. Used by external tools.

See Also:
Constant Field Values

SETTING_REFRESH_ON_LOGON

public static final java.lang.String SETTING_REFRESH_ON_LOGON
Requests that state and message data be refreshed from the message store at logon, if possible. This supports simple failover behavior for acceptors

See Also:
Constant Field Values

SETTING_SEND_REDUNDANT_RESEND_REQUEST

public static final java.lang.String SETTING_SEND_REDUNDANT_RESEND_REQUEST
Configures the session to send redundant resend requests (off, by default).

See Also:
Constant Field Values

SETTING_PERSIST_MESSAGES

public static final java.lang.String SETTING_PERSIST_MESSAGES
Persist messages setting (true, by default). If set to false this will cause the Session to not persist any messages and all resend requests will be answered with a gap fill.

See Also:
Constant Field Values

USE_CLOSED_RESEND_INTERVAL

public static final java.lang.String USE_CLOSED_RESEND_INTERVAL
Use actual end of sequence gap for resend requests rather than using "infinity" as the end sequence of the gap. Not recommended by the FIX specification, but needed for some counterparties.

See Also:
Constant Field Values

SETTING_ALLOW_UNKNOWN_MSG_FIELDS

public static final java.lang.String SETTING_ALLOW_UNKNOWN_MSG_FIELDS
Allow unknown fields in messages. This is intended for unknown fields with tags < 5000 (not user defined fields)

See Also:
Constant Field Values

SETTING_DEFAULT_APPL_VER_ID

public static final java.lang.String SETTING_DEFAULT_APPL_VER_ID
See Also:
Constant Field Values

SETTING_DISABLE_HEART_BEAT_CHECK

public static final java.lang.String SETTING_DISABLE_HEART_BEAT_CHECK
Allow to disable heart beat failure detection

See Also:
Constant Field Values

REJECT_INVALID_MESSAGE

public static final java.lang.String REJECT_INVALID_MESSAGE
Allow to ignore heart beat message

See Also:
Constant Field Values

SETTING_CHECK_GAP_FIELD_ON_ADMIN_MESSAGE

public static final java.lang.String SETTING_CHECK_GAP_FIELD_ON_ADMIN_MESSAGE
Allow to disable gap field check on administrative message. Valid values are "Y" or "N". Default is "Y".

See Also:
Constant Field Values

SETTING_FORCE_RESEND_WHEN_CORRUPTED_STORE

public static final java.lang.String SETTING_FORCE_RESEND_WHEN_CORRUPTED_STORE
See Also:
Constant Field Values

DEFAULT_MAX_LATENCY

public static final int DEFAULT_MAX_LATENCY
See Also:
Constant Field Values

DEFAULT_TEST_REQUEST_DELAY_MULTIPLIER

public static final double DEFAULT_TEST_REQUEST_DELAY_MULTIPLIER
See Also:
Constant Field Values

log

protected static final org.slf4j.Logger log
Method Detail

setForceResendWhenCorruptedStore

public void setForceResendWhenCorruptedStore(boolean forceResendWhenCorruptedStore)

getMessageFactory

public MessageFactory getMessageFactory()

setResponder

public void setResponder(Responder responder)
Registers a responder with the session. This is used by the acceptor and initiator implementations.

Parameters:
responder - a responder implementation

getResponder

public Responder getResponder()

hasResponder

public boolean hasResponder()
This should not be used by end users.

Returns:
the Session's connection responder

sendToTarget

public static boolean sendToTarget(Message message)
                            throws SessionNotFound
Send a message to the session specified in the message's target identifiers.

Parameters:
message - a FIX message
Returns:
true is send was successful, false otherwise
Throws:
SessionNotFound - if session could not be located

sendToTarget

public static boolean sendToTarget(Message message,
                                   java.lang.String qualifier)
                            throws SessionNotFound
Send a message to the session specified in the message's target identifiers. The session qualifier is used to distinguish sessions with the same target identifiers.

Parameters:
message - a FIX message
qualifier - a session qualifier
Returns:
true is send was successful, false otherwise
Throws:
SessionNotFound - if session could not be located

sendToTarget

public static boolean sendToTarget(Message message,
                                   java.lang.String senderCompID,
                                   java.lang.String targetCompID)
                            throws SessionNotFound
Send a message to the session specified by the provided target company ID. The sender company ID is provided as an argument rather than from the message.

Parameters:
message - a FIX message
senderCompID - the sender's company ID
targetCompID - the target's company ID
Returns:
true is send was successful, false otherwise
Throws:
SessionNotFound - if session could not be located

sendToTarget

public static boolean sendToTarget(Message message,
                                   java.lang.String senderCompID,
                                   java.lang.String targetCompID,
                                   java.lang.String qualifier)
                            throws SessionNotFound
Send a message to the session specified by the provided target company ID. The sender company ID is provided as an argument rather than from the message. The session qualifier is used to distinguish sessions with the same target identifiers.

Parameters:
message - a FIX message
senderCompID - the sender's company ID
targetCompID - the target's company ID
qualifier - a session qualifier
Returns:
true is send was successful, false otherwise
Throws:
SessionNotFound - if session could not be located

sendToTarget

public static boolean sendToTarget(Message message,
                                   SessionID sessionID)
                            throws SessionNotFound
Send a message to the session specified by the provided session ID.

Parameters:
message - a FIX message
sessionID - the target SessionID
Returns:
true is send was successful, false otherwise
Throws:
SessionNotFound - if session could not be located

lookupSession

public static Session lookupSession(SessionID sessionID)
Locates a session specified by the provided session ID.

Parameters:
sessionID - the session ID
Returns:
the session, if found, or null otherwise

logon

public void logon()
This method can be used to manually logon to a FIX session.


logout

public void logout()
This method can be used to manually logout of a FIX session.


logout

public void logout(java.lang.String reason)
This method can be used to manually logout of a FIX session.

Parameters:
reason - this will be included in the logout message

isEnabled

public boolean isEnabled()
Used internally by initiator implementation.

Returns:
true if session is enabled, false otherwise.

sentLogon

public boolean sentLogon()
Predicate indicating whether a logon message has been sent. (QF Compatibility)

Returns:
true if logon message was sent, false otherwise.

receivedLogon

public boolean receivedLogon()
Predicate indicating whether a logon message has been received. (QF Compatibility)

Returns:
true if logon message was received, false otherwise.

sentLogout

public boolean sentLogout()
Predicate indicating whether a logout message has been sent. (QF Compatibility)

Returns:
true if logout message was sent, false otherwise.

receivedLogout

public boolean receivedLogout()
Predicate indicating whether a logout message has been received. This can be used to determine if a session ended with an unexpected disconnect.

Returns:
true if logout message has been received, false otherwise.

isLoggedOn

public boolean isLoggedOn()
Is the session logged on.

Returns:
true if logged on, false otherwise.

reset

public void reset()
           throws java.io.IOException
Logouts and disconnects session and then resets session state.

Throws:
java.io.IOException - IO error
See Also:
SessionState.reset()

setNextSenderMsgSeqNum

public void setNextSenderMsgSeqNum(int num)
                            throws java.io.IOException
Set the next outgoing message sequence number. This method is not synchronized.

Parameters:
num - next outgoing sequence number
Throws:
java.io.IOException - IO error

setNextTargetMsgSeqNum

public void setNextTargetMsgSeqNum(int num)
                            throws java.io.IOException
Set the next expected target message sequence number. This method is not synchronized.

Parameters:
num - next expected target sequence number
Throws:
java.io.IOException - IO error

getExpectedSenderNum

public int getExpectedSenderNum()
Retrieves the expected sender sequence number. This method is not synchronized.

Returns:
next expected sender sequence number

getExpectedTargetNum

public int getExpectedTargetNum()
Retrieves the expected target sequence number. This method is not synchronized.

Returns:
next expected target sequence number

getLog

public Log getLog()

getStore

public MessageStore getStore()
Get the message store. (QF Compatibility)

Returns:
the message store

next

public void next(Message message)
          throws FieldNotFound,
                 RejectLogon,
                 IncorrectDataFormat,
                 IncorrectTagValue,
                 UnsupportedMessageType,
                 java.io.IOException,
                 InvalidMessage
(Internal use only)

Throws:
FieldNotFound
RejectLogon
IncorrectDataFormat
IncorrectTagValue
UnsupportedMessageType
java.io.IOException
InvalidMessage

next

public void next()
          throws java.io.IOException
Called from the timer-related code in the acceptor/initiator implementations. This is not typically called from application code.

Throws:
java.io.IOException - IO error

disconnect

public void disconnect()
                throws java.io.IOException
Deprecated. 

Use disconnect(reason, logError) instead.

Throws:
java.io.IOException

disconnect

public void disconnect(java.lang.String reason,
                       boolean logError)
                throws java.io.IOException
Logs out from session and closes the network connection.

Parameters:
reason - the reason why the session is disconnected
logError - set to true if this disconnection is an error
Throws:
java.io.IOException - IO error

send

public boolean send(Message message)
Send a message to a counterparty. Sequence numbers and information about the sender and target identification will be added automatically (or overwritten if that information already is present). The returned status flag is included for compatibility with the JNI API but it's usefulness is questionable. In QuickFIX/J, the message is transmitted using asynchronous network I/O so the boolean only indicates the message was successfully queued for transmission. An error could still occur before the message data is actually sent.

Parameters:
message - the message to send
Returns:
a status flag indicating whether the write to the network layer was successful.

setDataDictionary

public void setDataDictionary(DataDictionary dataDictionary)
Deprecated. 

Set the data dictionary. (QF Compatibility)

Parameters:
dataDictionary -

getDataDictionary

public DataDictionary getDataDictionary()

getDataDictionaryProvider

public DataDictionaryProvider getDataDictionaryProvider()

getSessionID

public SessionID getSessionID()

isSessionTime

public boolean isSessionTime()
Predicate for determining if the session should be active at the current time.

Returns:
true if session should be active, false otherwise.

doesSessionExist

public static boolean doesSessionExist(SessionID sessionID)
Determine if a session exists with the given ID.

Parameters:
sessionID -
Returns:
true if session exists, false otherwise.

numSessions

public static int numSessions()
Return the session count.

Returns:
the number of sessions

setLogonTimeout

public void setLogonTimeout(int seconds)
Sets the timeout for waiting for a logon response.

Parameters:
seconds - the timeout in seconds

setLogoutTimeout

public void setLogoutTimeout(int seconds)
Sets the timeout for waiting for a logout response.

Parameters:
seconds - the timeout in seconds

setHeartBeatInterval

public void setHeartBeatInterval(int heartbeatInterval)
Internal use by acceptor code.

Parameters:
heartbeatInterval -

getCheckCompID

public boolean getCheckCompID()

getLogonTimeout

public int getLogonTimeout()

getLogoutTimeout

public int getLogoutTimeout()

getRedundantResentRequestsAllowed

public boolean getRedundantResentRequestsAllowed()

getRefreshOnLogon

public boolean getRefreshOnLogon()

getResetOnDisconnect

public boolean getResetOnDisconnect()

getResetOnLogout

public boolean getResetOnLogout()

isLogonAlreadySent

public boolean isLogonAlreadySent()

isLogonReceived

public boolean isLogonReceived()

isLogonSendNeeded

public boolean isLogonSendNeeded()

isLogonSent

public boolean isLogonSent()

isLogonTimedOut

public boolean isLogonTimedOut()

isLogoutReceived

public boolean isLogoutReceived()

isLogoutSent

public boolean isLogoutSent()

isLogoutTimedOut

public boolean isLogoutTimedOut()

isUsingDataDictionary

public boolean isUsingDataDictionary()

getStartTime

public java.util.Date getStartTime()
                            throws java.io.IOException
Throws:
java.io.IOException

getTestRequestDelayMultiplier

public double getTestRequestDelayMultiplier()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addStateListener

public void addStateListener(SessionStateListener listener)

removeStateListener

public void removeStateListener(SessionStateListener listener)

getSenderDefaultApplicationVersionID

public ApplVerID getSenderDefaultApplicationVersionID()
Returns:
the default application version ID for messages sent from this session

getTargetDefaultApplicationVersionID

public ApplVerID getTargetDefaultApplicationVersionID()
Returns:
the default application version ID for messages received by this session

extractExpectedSequenceNumber

protected static java.lang.Integer extractExpectedSequenceNumber(java.lang.String txt)

setIgnoreHeartBeatFailure

public void setIgnoreHeartBeatFailure(boolean ignoreHeartBeatFailure)

setRejectInvalidMessage

public void setRejectInvalidMessage(boolean RejectInvalidMessage)

isCheckGapFieldOnAdminMessage

public boolean isCheckGapFieldOnAdminMessage()

setCheckGapFieldOnAdminMessage

public void setCheckGapFieldOnAdminMessage(boolean checkGapFieldOnAdminMessage)