|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectquickfix.Session
public class Session
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 |
---|
public static final java.lang.String SETTING_HEARTBTINT
public static final java.lang.String SETTING_CHECK_LATENCY
public static final java.lang.String SETTING_CHECK_COMP_ID
public static final java.lang.String SETTING_MAX_LATENCY
public static final java.lang.String SETTING_TEST_REQUEST_DELAY_MULTIPLIER
public static final java.lang.String SETTING_NON_STOP_SESSION
public static final java.lang.String SETTING_START_DAY
public static final java.lang.String SETTING_END_DAY
public static final java.lang.String SETTING_TIMEZONE
public static final java.lang.String SETTING_START_TIME
public static final java.lang.String SETTING_END_TIME
public static final java.lang.String SETTING_USE_DATA_DICTIONARY
public static final java.lang.String SETTING_DATA_DICTIONARY
public static final java.lang.String SETTING_TRANSPORT_DATA_DICTIONARY
public static final java.lang.String SETTING_APP_DATA_DICTIONARY
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.
public static final java.lang.String SETTING_VALIDATE_FIELDS_OUT_OF_ORDER
public static final java.lang.String SETTING_VALIDATE_FIELDS_HAVE_VALUES
public static final java.lang.String SETTING_LOGON_TIMEOUT
public static final java.lang.String SETTING_LOGOUT_TIMEOUT
public static final java.lang.String SETTING_RESET_ON_LOGOUT
public static final java.lang.String SETTING_FORCE_RESYNC
public static final java.lang.String SETTING_RESET_ON_DISCONNECT
public static final java.lang.String SETTING_RESET_ON_ERROR
public static final java.lang.String SETTING_DISCONNECT_ON_ERROR
public static final java.lang.String SETTING_MILLISECONDS_IN_TIMESTAMP
public static final java.lang.String SETTING_VALIDATE_USER_DEFINED_FIELDS
public static final java.lang.String SETTING_RESET_ON_LOGON
public static final java.lang.String SETTING_DESCRIPTION
public static final java.lang.String SETTING_REFRESH_ON_LOGON
public static final java.lang.String SETTING_SEND_REDUNDANT_RESEND_REQUEST
public static final java.lang.String SETTING_PERSIST_MESSAGES
public static final java.lang.String USE_CLOSED_RESEND_INTERVAL
public static final java.lang.String SETTING_ALLOW_UNKNOWN_MSG_FIELDS
public static final java.lang.String SETTING_DEFAULT_APPL_VER_ID
public static final java.lang.String SETTING_DISABLE_HEART_BEAT_CHECK
public static final java.lang.String REJECT_INVALID_MESSAGE
public static final java.lang.String SETTING_CHECK_GAP_FIELD_ON_ADMIN_MESSAGE
public static final java.lang.String SETTING_FORCE_RESEND_WHEN_CORRUPTED_STORE
public static final int DEFAULT_MAX_LATENCY
public static final double DEFAULT_TEST_REQUEST_DELAY_MULTIPLIER
protected static final org.slf4j.Logger log
Method Detail |
---|
public void setForceResendWhenCorruptedStore(boolean forceResendWhenCorruptedStore)
public MessageFactory getMessageFactory()
public void setResponder(Responder responder)
responder
- a responder implementationpublic Responder getResponder()
public boolean hasResponder()
public static boolean sendToTarget(Message message) throws SessionNotFound
message
- a FIX message
SessionNotFound
- if session could not be locatedpublic static boolean sendToTarget(Message message, java.lang.String qualifier) throws SessionNotFound
message
- a FIX messagequalifier
- a session qualifier
SessionNotFound
- if session could not be locatedpublic static boolean sendToTarget(Message message, java.lang.String senderCompID, java.lang.String targetCompID) throws SessionNotFound
message
- a FIX messagesenderCompID
- the sender's company IDtargetCompID
- the target's company ID
SessionNotFound
- if session could not be locatedpublic static boolean sendToTarget(Message message, java.lang.String senderCompID, java.lang.String targetCompID, java.lang.String qualifier) throws SessionNotFound
message
- a FIX messagesenderCompID
- the sender's company IDtargetCompID
- the target's company IDqualifier
- a session qualifier
SessionNotFound
- if session could not be locatedpublic static boolean sendToTarget(Message message, SessionID sessionID) throws SessionNotFound
message
- a FIX messagesessionID
- the target SessionID
SessionNotFound
- if session could not be locatedpublic static Session lookupSession(SessionID sessionID)
sessionID
- the session ID
public void logon()
public void logout()
public void logout(java.lang.String reason)
reason
- this will be included in the logout messagepublic boolean isEnabled()
public boolean sentLogon()
public boolean receivedLogon()
public boolean sentLogout()
public boolean receivedLogout()
public boolean isLoggedOn()
public void reset() throws java.io.IOException
java.io.IOException
- IO errorSessionState.reset()
public void setNextSenderMsgSeqNum(int num) throws java.io.IOException
num
- next outgoing sequence number
java.io.IOException
- IO errorpublic void setNextTargetMsgSeqNum(int num) throws java.io.IOException
num
- next expected target sequence number
java.io.IOException
- IO errorpublic int getExpectedSenderNum()
public int getExpectedTargetNum()
public Log getLog()
public MessageStore getStore()
public void next(Message message) throws FieldNotFound, RejectLogon, IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType, java.io.IOException, InvalidMessage
FieldNotFound
RejectLogon
IncorrectDataFormat
IncorrectTagValue
UnsupportedMessageType
java.io.IOException
InvalidMessage
public void next() throws java.io.IOException
java.io.IOException
- IO errorpublic void disconnect() throws java.io.IOException
java.io.IOException
public void disconnect(java.lang.String reason, boolean logError) throws java.io.IOException
reason
- the reason why the session is disconnectedlogError
- set to true if this disconnection is an error
java.io.IOException
- IO errorpublic boolean send(Message message)
message
- the message to send
public void setDataDictionary(DataDictionary dataDictionary)
dataDictionary
- public DataDictionary getDataDictionary()
public DataDictionaryProvider getDataDictionaryProvider()
public SessionID getSessionID()
public boolean isSessionTime()
public static boolean doesSessionExist(SessionID sessionID)
sessionID
-
public static int numSessions()
public void setLogonTimeout(int seconds)
seconds
- the timeout in secondspublic void setLogoutTimeout(int seconds)
seconds
- the timeout in secondspublic void setHeartBeatInterval(int heartbeatInterval)
heartbeatInterval
- public boolean getCheckCompID()
public int getLogonTimeout()
public int getLogoutTimeout()
public boolean getRedundantResentRequestsAllowed()
public boolean getRefreshOnLogon()
public boolean getResetOnDisconnect()
public boolean getResetOnLogout()
public boolean isLogonAlreadySent()
public boolean isLogonReceived()
public boolean isLogonSendNeeded()
public boolean isLogonSent()
public boolean isLogonTimedOut()
public boolean isLogoutReceived()
public boolean isLogoutSent()
public boolean isLogoutTimedOut()
public boolean isUsingDataDictionary()
public java.util.Date getStartTime() throws java.io.IOException
java.io.IOException
public double getTestRequestDelayMultiplier()
public java.lang.String toString()
toString
in class java.lang.Object
public void addStateListener(SessionStateListener listener)
public void removeStateListener(SessionStateListener listener)
public ApplVerID getSenderDefaultApplicationVersionID()
public ApplVerID getTargetDefaultApplicationVersionID()
protected static java.lang.Integer extractExpectedSequenceNumber(java.lang.String txt)
public void setIgnoreHeartBeatFailure(boolean ignoreHeartBeatFailure)
public void setRejectInvalidMessage(boolean RejectInvalidMessage)
public boolean isCheckGapFieldOnAdminMessage()
public void setCheckGapFieldOnAdminMessage(boolean checkGapFieldOnAdminMessage)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |