Class AbstractFIXSession
- All Implemented Interfaces:
FIXSession
,ExtendedFIXSession
,com.epam.fixengine.session.SessionStateListenSupport
- Direct Known Subclasses:
AcceptorFIXSession
,InitiatorFIXSession
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.epam.fixengine.session.util.ConfigurationAdaptor
protected boolean
protected final HandlerChain
protected final FIXMessageFactory
protected com.epam.fixengine.configuration.SendingMode
protected Queue<FIXFieldListWithType>
protected FIXSessionRuntimeState
protected com.epam.fixengine.session.util.MutableInteger
protected final com.epam.fixengine.session.SessionSequenceManager
protected final Object
protected SessionParameters
protected com.epam.fixengine.session.util.TestReqIDTimestamp
protected FIXTransport
Fields inherited from interface com.epam.fixengine.FIXSession
DEFAULT_SENDING_OPTIONS, SEND_ASYNC, SEND_SYNC
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractFIXSession
(FIXMessageFactory messageFactory, SessionParameters sessionParameters, HandlerChain fixSessionListener) Creates theAbstractFIXSession
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add listeners to receive session level incoming messages.void
addOutSessionLevelMessageListener
(com.epam.fixengine.session.TypedFIXMessageListener listener) void
addSessionStateListener
(com.epam.fixengine.session.FIXSessionStateListener stateListener) void
addUserGlobalMessageHandler
(com.epam.fixengine.session.messagehandler.AbstractUserGlobalMessageHandler userMessageHandler) void
void
The method checks if TR send or received.void
void
Clears output message queue.abstract void
connect()
Connects to remote counterparty, if initiator or accepts incoming connection if acceptor.void
disconnect
(DisconnectReason reasonType, String reasonDescription) protected void
disconnect
(DisconnectReason reasonType, String reasonDescription, boolean isGracefull, boolean isForced) protected void
disconnect
(DisconnectReason reasonType, String reasonDescription, boolean isGracefull, boolean isForced, boolean continueReading) protected void
disconnect
(DisconnectReason reasonType, String reasonDescription, boolean isGracefull, boolean isForced, boolean continueReading, boolean sendLogout) void
disconnect
(String reason) Disconnect the session.protected void
Disconnect the session if test request doesn't received.void
dispose()
Disposes current session, removes its reference from GlobalSessionManager and frees all allocated resources.boolean
void
forcedDisconnect
(DisconnectReason reasonType, String reasonDescription, boolean continueReading) Gracefully disconnects current session but wait for answer forcedLogoffTimeout.getAttribute
(com.epam.fixengine.session.ExtendedFIXSessionAttribute key) getAttribute
(String key) Gets session attribute value.boolean
getAttributeAsBool
(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr) long
getAttributeAsLong
(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr) long
Gets read bytes.long
Gets send bytes.protected com.epam.fixengine.session.util.ConfigurationAdaptor
com.epam.fixengine.encryption.Encryption
Gets session error handler.long
Gets established session timestamp.Gets extended fix session listener.Gets incoming message storage.long
long
Gets last received message timestamp.long
Gets time when the message is sentGets message factory.protected HandlerChain
Gets chain of message handlers.Gets internal message queue.Returns message validator.getMessageValidator
(String newAppVersion) Returns message validator by appVersion.getMessageValidator
(String newAppVersion, FIXVersion baseFixVersion) Returns message validator by appVersion.long
Gets number of received message.long
Gets number of sent message.Gets outgoing message storage.long
int
Gets reject message listener.Gets session parameter instance.com.epam.fixengine.session.SessionSequenceManager
The returned value is cloned.Gets session parameter instance.Returns session state.Gets storage factoryint
hashCode()
void
init()
Initialize FIX session.protected void
Initialize session internal.protected FIXSessionRuntimeState
initSessionRuntimeState
(SessionParameters sessionParameters) boolean
protected boolean
boolean
Shows statistics on or off.void
void
Marks the session shutdown as gracefully.protected void
protected void
Initializes the resources and sends a logon message.prepareMessage
(FIXFieldList message, MessageStructure structure) Builds FIXFieldList object from FIXFieldList object.prepareMessage
(FIXFieldList message, String type, MessageStructure structure) Builds FIXFieldList object from FIXFieldList object.prepareMessage
(String msgType, MessageStructure userStructure) Builds FIXFieldList object with specified type, message structure and prefilled header informationprepareMessageFromString
(byte[] message, MessageStructure structure) Builds FIXFieldList object from String object.prepareMessageFromString
(byte[] message, String type, MessageStructure structure) Builds FIXFieldList object from String object.void
reinit()
Reset session state and reinit it from stored.abstract void
Reject incoming connection for acceptor.void
removeAttribute
(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr) void
removeAttribute
(String key) Removes session attribute.void
removeLongAttribute
(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr) void
removeSessionStateListener
(com.epam.fixengine.session.FIXSessionStateListener stateListener) protected void
void
Allows user to reset sequences numbers by sending logon with 141=Y.void
resetSequenceNumbers
(boolean checkGapFillBefore) Allows user to reset sequences numbers by sending logon with 141=Y.protected void
protected void
Restore the session if test request is received.void
Save session parameters to file.boolean
sendAsIs
(FIXFieldList message) Convenient method to send out FIX message based on the message type and message content.boolean
sendAsIs
(FIXFieldList message, int options) Convenient method to send out FIX message based on the message type and message content.boolean
sendMessage
(FIXFieldList message) Convenient method to send out user built FIX message.boolean
sendMessage
(FIXFieldList message, int optionMask) Convenient method to send out user built FIX message.boolean
sendMessage
(String type, FIXFieldList content) Convenient method to send out FIX message based on the message type and message content.boolean
sendMessage
(String type, FIXFieldList content, int optionMask) Convenient method to send out FIX message based on the message type and message content.int
sendMessageAndGetQueueSize
(FIXFieldList message, int optionMask) Do the same thatFIXSession.sendMessage(FIXFieldList, int)
and return queue size.int
sendMessageAndGetQueueSize
(String type, FIXFieldList content, int optionMask) Do the same thatFIXSession.sendMessage(String, FIXFieldList, int)
and return queue size.boolean
sendMessageOutOfTurn
(String type, FIXFieldList message) Sends message out of turn.protected void
Send test request.boolean
sendWithChanges
(FIXFieldList content, ChangesType allowedChangesType) Convenient method to send out FIX message based on the message type and message content.boolean
sendWithChanges
(FIXFieldList content, ChangesType allowedChangesType, int options) Convenient method to send out FIX message based on the message type and message content.int
sendWithChangesAndGetQueueSize
(FIXFieldList content, ChangesType allowedChangesType) int
sendWithChangesAndGetQueueSize
(FIXFieldList content, ChangesType allowedChangesType, int options) Do the same thatFIXSession.sendWithChanges(FIXFieldList, ChangesType, int)
and return queue size.void
setAttribute
(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr, boolean value) void
setAttribute
(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr, long value) void
setAttribute
(com.epam.fixengine.session.ExtendedFIXSessionAttribute key, Object object) void
setAttribute
(String key, Object value) Sets session attribute.void
setErrorHandler
(ErrorHandler handler) Sets error handler.void
setFIXSessionListener
(FIXSessionListener listener) Sets FIXSession listener to monitor session status and receive incoming messages.void
void
setInSeqNum
(long inSeqNum) protected void
void
setOutOfTurnMode
(boolean mode) Sets OutOf turn mode.void
setOutSeqNum
(long outSeqNum) protected void
setPreLogoffSessionState
(boolean forced, boolean continueReading) void
Sets reject listener.void
setSequenceNumbers
(long inSeqNum, long outSeqNum) Allows user to change sequences numbers for disconnected sessions.void
setSessionState
(SessionState sessionState) Sets session state.void
setSlowConsumerListener
(FIXSessionSlowConsumerListener slowConsumerListener) Sets slow consumer message listener.void
shutdown
(boolean blocking) Deprecated.see AbstractFIXSession#shutdown(DisconnectReason reason, boolean blocking)void
shutdown
(DisconnectReason reason, boolean blocking) Shutdown the session.protected void
void
subscribeForAttributeChanges
(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr, com.epam.fixengine.session.ExtendedFIXSessionAttributeListener listener) toString()
void
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.epam.fixengine.session.ExtendedFIXSession
getAndRemoveAttribute
-
Field Details
-
transport
-
queue
-
listener
-
sessionParameters
-
runtimeState
-
messageFactory
-
graceful
protected boolean graceful -
sequenceManager
protected final com.epam.fixengine.session.SessionSequenceManager sequenceManager -
testRequestTime
protected com.epam.fixengine.session.util.TestReqIDTimestamp testRequestTime -
sentTRNum
protected com.epam.fixengine.session.util.MutableInteger sentTRNum -
sessionLock
-
configuration
protected final com.epam.fixengine.session.util.ConfigurationAdaptor configuration -
preferredSendingMode
protected com.epam.fixengine.configuration.SendingMode preferredSendingMode
-
-
Constructor Details
-
AbstractFIXSession
protected AbstractFIXSession(FIXMessageFactory messageFactory, SessionParameters sessionParameters, HandlerChain fixSessionListener) Creates theAbstractFIXSession
.
-
-
Method Details
-
getConfiguration
protected com.epam.fixengine.session.util.ConfigurationAdaptor getConfiguration() -
initSessionRuntimeState
-
getSequenceManager
public com.epam.fixengine.session.SessionSequenceManager getSequenceManager() -
getExtendedFIXSessionListener
Description copied from interface:ExtendedFIXSession
Gets extended fix session listener.- Specified by:
getExtendedFIXSessionListener
in interfaceExtendedFIXSession
- See Also:
-
getStorageFactory
Gets storage factory -
getRejectMessageListener
Description copied from interface:ExtendedFIXSession
Gets reject message listener.- Specified by:
getRejectMessageListener
in interfaceExtendedFIXSession
- Returns:
- reject message listener
- See Also:
-
getErrorHandler
Description copied from interface:ExtendedFIXSession
Gets session error handler.- Specified by:
getErrorHandler
in interfaceExtendedFIXSession
- Returns:
- error handler
- See Also:
-
setErrorHandler
Description copied from interface:FIXSession
Sets error handler.- Specified by:
setErrorHandler
in interfaceFIXSession
- Parameters:
handler
- the error handler- See Also:
-
setRejectMessageListener
Description copied from interface:FIXSession
Sets reject listener.- Specified by:
setRejectMessageListener
in interfaceFIXSession
- Parameters:
listener
- the reject message listener- See Also:
-
setFIXSessionOutOfSyncListener
- Specified by:
setFIXSessionOutOfSyncListener
in interfaceExtendedFIXSession
-
getFIXSessionOutOfSyncListener
- Specified by:
getFIXSessionOutOfSyncListener
in interfaceExtendedFIXSession
-
getSlowConsumerListener
-
setSlowConsumerListener
Description copied from interface:FIXSession
Sets slow consumer message listener.- Specified by:
setSlowConsumerListener
in interfaceFIXSession
- Parameters:
slowConsumerListener
- slow consumer listener- See Also:
-
markShutdownAsGraceful
public void markShutdownAsGraceful()Description copied from interface:ExtendedFIXSession
Marks the session shutdown as gracefully.- Specified by:
markShutdownAsGraceful
in interfaceExtendedFIXSession
-
clearQueue
public void clearQueue()Description copied from interface:ExtendedFIXSession
Clears output message queue. Method also reject all messages from the queue. To use this feature, the user should set theRejectMessageListener
listener. TODO: @return true if session was able to reject all messages and clean queue (enableMessageRejecting option is enabled)- Specified by:
clearQueue
in interfaceExtendedFIXSession
- See Also:
-
getQueuedMessagesCount
public int getQueuedMessagesCount()- Specified by:
getQueuedMessagesCount
in interfaceExtendedFIXSession
-
lockSending
public void lockSending()- Specified by:
lockSending
in interfaceExtendedFIXSession
-
unlockSending
public void unlockSending()- Specified by:
unlockSending
in interfaceExtendedFIXSession
-
setOutOfTurnMode
public void setOutOfTurnMode(boolean mode) Description copied from interface:ExtendedFIXSession
Sets OutOf turn mode.- Specified by:
setOutOfTurnMode
in interfaceExtendedFIXSession
- Parameters:
mode
- the mode
-
resetSequenceNumbers
Description copied from interface:FIXSession
Allows user to reset sequences numbers by sending logon with 141=Y. Notice: Only supported for FIX versions 4.1 and above. Notice: The logon message will be send only when session is in connected state.- Specified by:
resetSequenceNumbers
in interfaceFIXSession
- Throws:
IOException
- See Also:
-
resetSequenceNumbers
Description copied from interface:FIXSession
Allows user to reset sequences numbers by sending logon with 141=Y. Notice: Only supported for FIX versions 4.1 and above. Notice: The logon message will be send only when session is in connected state.- Specified by:
resetSequenceNumbers
in interfaceFIXSession
- Parameters:
checkGapFillBefore
- - the flag indicates if needed to check the seq num.If true the TR will be sent before introday logon otherwise only intraday logon will be sent.
- Throws:
IOException
- See Also:
-
setSequenceNumbers
Description copied from interface:FIXSession
Allows user to change sequences numbers for disconnected sessions.- Specified by:
setSequenceNumbers
in interfaceFIXSession
- Parameters:
inSeqNum
- new incoming sequence number. If new value is < 0, then this parameter will be ignored.outSeqNum
- new outgoing sequence number. If new value is < 0, then this parameter will be ignored.- Throws:
IOException
-
setFIXSessionListener
Description copied from interface:FIXSession
Sets FIXSession listener to monitor session status and receive incoming messages.- Specified by:
setFIXSessionListener
in interfaceFIXSession
- Parameters:
listener
- the user specified listener- See Also:
-
addInSessionLevelMessageListener
Description copied from interface:FIXSession
Add listeners to receive session level incoming messages. FIX session level message type:- 'A' - Logon
- '0' - Heartbeat
- '1' - Test Request
- '2' - Resend Request
- '3' - Reject
- '4' - Sequence Reset
- '5' - Logout
- Specified by:
addInSessionLevelMessageListener
in interfaceFIXSession
- Parameters:
listener
- the user specified listener- See Also:
-
addOutSessionLevelMessageListener
public void addOutSessionLevelMessageListener(com.epam.fixengine.session.TypedFIXMessageListener listener) - Specified by:
addOutSessionLevelMessageListener
in interfaceFIXSession
-
addUserGlobalMessageHandler
public void addUserGlobalMessageHandler(com.epam.fixengine.session.messagehandler.AbstractUserGlobalMessageHandler userMessageHandler) - Specified by:
addUserGlobalMessageHandler
in interfaceFIXSession
-
getOutgoingMessageStorage
Description copied from interface:ExtendedFIXSession
Gets outgoing message storage.- Specified by:
getOutgoingMessageStorage
in interfaceExtendedFIXSession
- Returns:
- message storage
- See Also:
-
getIncomingMessageStorage
Description copied from interface:ExtendedFIXSession
Gets incoming message storage.- Specified by:
getIncomingMessageStorage
in interfaceExtendedFIXSession
- Returns:
- message storage
- See Also:
-
getMessageQueue
Description copied from interface:ExtendedFIXSession
Gets internal message queue.- Specified by:
getMessageQueue
in interfaceExtendedFIXSession
- Returns:
- message storage
- See Also:
-
saveSessionParameters
Description copied from interface:ExtendedFIXSession
Save session parameters to file.- Specified by:
saveSessionParameters
in interfaceExtendedFIXSession
- Throws:
IOException
- if I/O error occurred- See Also:
-
connect
Description copied from interface:FIXSession
Connects to remote counterparty, if initiator or accepts incoming connection if acceptor.- Specified by:
connect
in interfaceFIXSession
- Throws:
IOException
- I/O exception if error occurred- See Also:
-
reject
Description copied from interface:FIXSession
Reject incoming connection for acceptor. Not applicable for initiator.- Specified by:
reject
in interfaceFIXSession
- Throws:
IOException
- I/O exception if error occurred- See Also:
-
getSessionParametersInstance
Description copied from interface:ExtendedFIXSession
Gets session parameter instance.- Specified by:
getSessionParametersInstance
in interfaceExtendedFIXSession
- See Also:
-
getMessageFactory
Description copied from interface:ExtendedFIXSession
Gets message factory.- Specified by:
getMessageFactory
in interfaceExtendedFIXSession
- Returns:
- message factory
- See Also:
-
getSessionParameters
The returned value is cloned.- Specified by:
getSessionParameters
in interfaceFIXSession
- Returns:
- SessionParameters - session parameters
- See Also:
-
getSessionState
Description copied from interface:FIXSession
Returns session state.- Specified by:
getSessionState
in interfaceFIXSession
- Returns:
- SessionState - session state
- See Also:
-
setSessionState
Description copied from interface:ExtendedFIXSession
Sets session state.- Specified by:
setSessionState
in interfaceExtendedFIXSession
- Parameters:
sessionState
- the new session state- See Also:
-
getRuntimeState
Description copied from interface:ExtendedFIXSession
Gets session parameter instance.- Specified by:
getRuntimeState
in interfaceExtendedFIXSession
-
isStatisticEnabled
public boolean isStatisticEnabled()Description copied from interface:ExtendedFIXSession
Shows statistics on or off.- Specified by:
isStatisticEnabled
in interfaceExtendedFIXSession
- Returns:
- true is statistic is enabled
- See Also:
-
isHbtControlInPumper
public boolean isHbtControlInPumper() -
getBytesRead
public long getBytesRead()Description copied from interface:ExtendedFIXSession
Gets read bytes.- Specified by:
getBytesRead
in interfaceExtendedFIXSession
- Returns:
- number of read bytes or -1 if statistic is disabled
- See Also:
-
getEstablished
public long getEstablished()Description copied from interface:ExtendedFIXSession
Gets established session timestamp.- Specified by:
getEstablished
in interfaceExtendedFIXSession
- Returns:
- timestamp
- See Also:
-
getBytesSent
public long getBytesSent()Description copied from interface:ExtendedFIXSession
Gets send bytes.- Specified by:
getBytesSent
in interfaceExtendedFIXSession
- Returns:
- number of send bytes or -1 if statistic is disabled
- See Also:
-
getNoOfInMessages
public long getNoOfInMessages()Description copied from interface:ExtendedFIXSession
Gets number of received message.- Specified by:
getNoOfInMessages
in interfaceExtendedFIXSession
- Returns:
- number of received message or -1 if statistic is disabled
- See Also:
-
getNoOfOutMessages
public long getNoOfOutMessages()Description copied from interface:ExtendedFIXSession
Gets number of sent message.- Specified by:
getNoOfOutMessages
in interfaceExtendedFIXSession
- Returns:
- number of sent message or -1 if statistic is disabled
- See Also:
-
getLastInMessageTimestamp
public long getLastInMessageTimestamp()Description copied from interface:ExtendedFIXSession
Gets last received message timestamp.- Specified by:
getLastInMessageTimestamp
in interfaceExtendedFIXSession
- Returns:
- timestamp
- See Also:
-
getLastOutMessageTimestamp
public long getLastOutMessageTimestamp()Description copied from interface:ExtendedFIXSession
Gets time when the message is sent- Specified by:
getLastOutMessageTimestamp
in interfaceExtendedFIXSession
- Returns:
- time when the message is sent or -1 if statistic is disabled
- See Also:
-
getMessageHandlers
Gets chain of message handlers. -
onDisconnect
protected void onDisconnect() -
init
Description copied from interface:FIXSession
Initialize FIX session. This allows to put messages to session. These messages will be send after connect.- Specified by:
init
in interfaceFIXSession
- Throws:
IOException
- I/O exception if error occurred
-
reinit
Description copied from interface:ExtendedFIXSession
Reset session state and reinit it from stored.- Specified by:
reinit
in interfaceExtendedFIXSession
- Throws:
IOException
-
resetInitialization
protected void resetInitialization() -
prepareForConnect
Initializes the resources and sends a logon message.- Throws:
IOException
- - if I/O error occurred.
-
isResetSeqNumFlagRequiredForInitLogon
protected boolean isResetSeqNumFlagRequiredForInitLogon() -
initSessionInternal
Initialize session internal.The method is created all session object: in/out storage and pumper/reader, etc.
- Throws:
IOException
-
startSession
- Throws:
IOException
-
disconnect
Disconnect the session.The method sends the logof message, if response is not received during the HBI, shutdown the session.
- Specified by:
disconnect
in interfaceFIXSession
- Parameters:
reason
- the reason, if parameter is not null, the logof message will be send with 58=reason.- See Also:
-
disconnect
- Specified by:
disconnect
in interfaceExtendedFIXSession
-
forcedDisconnect
public void forcedDisconnect(DisconnectReason reasonType, String reasonDescription, boolean continueReading) Description copied from interface:ExtendedFIXSession
Gracefully disconnects current session but wait for answer forcedLogoffTimeout. Logoff with specified reason will be sent to your counterparty. Session will wait the answer for some period, defined by forcedLogoffTimeout configuration property. Note: This method doesn't guarantee immediate shutdown, since FIX protocol require us to wait for counterparty logoff reply. Note: Use this method if you need to close session in exceptional cases and when there is a chance that counterparty newer answer.- Specified by:
forcedDisconnect
in interfaceExtendedFIXSession
reasonDescription
- the reasoncontinueReading
- if false then reading of incoming messages will be stopped. This can be used for prevent reading of messages with broken sequencing.
-
disconnect
protected void disconnect(DisconnectReason reasonType, String reasonDescription, boolean isGracefull, boolean isForced) -
disconnect
protected void disconnect(DisconnectReason reasonType, String reasonDescription, boolean isGracefull, boolean isForced, boolean continueReading) -
disconnect
protected void disconnect(DisconnectReason reasonType, String reasonDescription, boolean isGracefull, boolean isForced, boolean continueReading, boolean sendLogout) -
shutdown
Deprecated.see AbstractFIXSession#shutdown(DisconnectReason reason, boolean blocking)Description copied from interface:ExtendedFIXSession
Shutdown the session.- Specified by:
shutdown
in interfaceExtendedFIXSession
- Parameters:
blocking
- If the parameter is true, the next call of method is blocking.
-
shutdown
Shutdown the session. If the parameterblocking
is true, the next call of method is blocking.- Specified by:
shutdown
in interfaceExtendedFIXSession
- Parameters:
blocking
- the blocking parameterreason
- disconnect reason
-
setPreLogoffSessionState
protected void setPreLogoffSessionState(boolean forced, boolean continueReading) -
sendMessage
Description copied from interface:FIXSession
Convenient method to send out FIX message based on the message type and message content. Depending on implementation and configuration may send message immediately or put it in the outgoing queue either persistent or stateless. If themsgType
is null, Engine sends the message as is; If themsgType
is "", Engine updates body length, sequence number, sending time and checksum fields; Otherwise Engine wraps thecontent
.If session is disposed no more messages should be send by session.
- Specified by:
sendMessage
in interfaceFIXSession
- Parameters:
type
- the message type (Tag 35 content)content
- the message contentoptionMask
-FIXSession.SEND_SYNC
orFIXSession.SEND_ASYNC
- Returns:
- true if message was send immediately, false - message was queued for later sending
- See Also:
-
sendMessageAndGetQueueSize
Description copied from interface:ExtendedFIXSession
Do the same thatFIXSession.sendMessage(String, FIXFieldList, int)
and return queue size.- Specified by:
sendMessageAndGetQueueSize
in interfaceExtendedFIXSession
- Returns:
- queue size. 0 if message was send synchronously
- See Also:
-
sendMessage
Description copied from interface:FIXSession
Convenient method to send out FIX message based on the message type and message content. Depending on implementation and configuration may send message immediately or put it in the outgoing queue either persistent or stateless. If themsgType
is null, Engine sends the message as is; If themsgType
is "", Engine updates body length, sequence number, sending time and checksum fields; Otherwise Engine wraps thecontent
.If session is disposed no more messages should be send by session.
- Specified by:
sendMessage
in interfaceFIXSession
- Parameters:
type
- the message type (Tag 35 content)content
- the message content- Returns:
- true if message was send immediately, false - message was queued for later sending
-
sendAsIs
Description copied from interface:FIXSession
Convenient method to send out FIX message based on the message type and message content. Depending on implementation and configuration may send message immediately or put it in the outgoing queue either persistent or stateless. The Engine sends the message as is.If session is disposed no more messages should be send by session.
- Specified by:
sendAsIs
in interfaceFIXSession
- Parameters:
message
- the message contentoptions
-FIXSession.SEND_SYNC
orFIXSession.SEND_ASYNC
- Returns:
- true if message was send immediately, false - message was queued for later sending
-
sendAsIs
Description copied from interface:FIXSession
Convenient method to send out FIX message based on the message type and message content. Depending on implementation and configuration may send message immediately or put it in the outgoing queue either persistent or stateless. The Engine sends the message as is.If session is disposed no more messages should be send by session.
- Specified by:
sendAsIs
in interfaceFIXSession
- Parameters:
message
- the message content- Returns:
- true if message was send immediately, false - message was queued for later sending
-
sendWithChanges
Description copied from interface:FIXSession
Convenient method to send out FIX message based on the message type and message content. Depending on implementation and configuration may send message immediately or put it in the outgoing queue either persistent or stateless. The Engine sends the message as is.If session is disposed no more messages should be send by session.
- Specified by:
sendWithChanges
in interfaceFIXSession
- Parameters:
content
- the message contentallowedChangesType
- the parameter takes the next values:options
-FIXSession.SEND_SYNC
orFIXSession.SEND_ASYNC
- Returns:
- true if message was send immediately, false - message was queued for later sending
- See Also:
-
sendWithChangesAndGetQueueSize
public int sendWithChangesAndGetQueueSize(FIXFieldList content, ChangesType allowedChangesType, int options) Description copied from interface:ExtendedFIXSession
Do the same thatFIXSession.sendWithChanges(FIXFieldList, ChangesType, int)
and return queue size.- Specified by:
sendWithChangesAndGetQueueSize
in interfaceExtendedFIXSession
- Returns:
- queue size. 0 if message was send synchronously
- See Also:
-
sendWithChanges
Description copied from interface:FIXSession
Convenient method to send out FIX message based on the message type and message content. Depending on implementation and configuration may send message immediately or put it in the outgoing queue either persistent or stateless. The Engine sends the message as is.If session is disposed no more messages should be send by session.
- Specified by:
sendWithChanges
in interfaceFIXSession
- Parameters:
content
- the message contentallowedChangesType
- the parameter takes the next values:- Returns:
- true if message was send immediately, false - message was queued for later sending
- See Also:
-
sendWithChangesAndGetQueueSize
-
prepareMessage
public FIXFieldList prepareMessage(FIXFieldList message, MessageStructure structure) throws PreparedMessageException Description copied from interface:FIXSession
Builds FIXFieldList object from FIXFieldList object.- Specified by:
prepareMessage
in interfaceFIXSession
- Parameters:
message
- FIXFieldList objectstructure
- message structure- Returns:
- FIXFieldList object
- Throws:
PreparedMessageException
- exception- See Also:
-
prepareMessage
public FIXFieldList prepareMessage(FIXFieldList message, String type, MessageStructure structure) throws PreparedMessageException Description copied from interface:FIXSession
Builds FIXFieldList object from FIXFieldList object.- Specified by:
prepareMessage
in interfaceFIXSession
- Parameters:
message
- FIXFieldList objecttype
- type of the messagestructure
- message structure- Returns:
- FIXFieldList object
- Throws:
PreparedMessageException
- exception- See Also:
-
prepareMessage
public FIXFieldList prepareMessage(String msgType, MessageStructure userStructure) throws PreparedMessageException Description copied from interface:FIXSession
Builds FIXFieldList object with specified type, message structure and prefilled header information- Specified by:
prepareMessage
in interfaceFIXSession
- Parameters:
msgType
- message typeuserStructure
- message structure- Returns:
- FIXFieldList object
- Throws:
PreparedMessageException
- See Also:
-
prepareMessageFromString
public FIXFieldList prepareMessageFromString(byte[] message, MessageStructure structure) throws PreparedMessageException Description copied from interface:FIXSession
Builds FIXFieldList object from String object.- Specified by:
prepareMessageFromString
in interfaceFIXSession
- Parameters:
message
- message stringstructure
- message structure object- Returns:
- FIXFieldList object
- Throws:
PreparedMessageException
- exception- See Also:
-
prepareMessageFromString
public FIXFieldList prepareMessageFromString(byte[] message, String type, MessageStructure structure) throws PreparedMessageException Description copied from interface:FIXSession
Builds FIXFieldList object from String object.- Specified by:
prepareMessageFromString
in interfaceFIXSession
- Parameters:
message
- message stringtype
- message typestructure
- message structure object- Returns:
- FIXFieldList object
- Throws:
PreparedMessageException
- exception- See Also:
-
sendMessage
Description copied from interface:FIXSession
Convenient method to send out user built FIX message. Depending on implementation and configuration may send message immediately or put it in the outgoing queue either persistent or stateless. The Engine updates the footer and header in themessage
.If session is disposed no more messages should be send by session.
- Specified by:
sendMessage
in interfaceFIXSession
- Parameters:
message
- the message- Returns:
- true if message was send immediately, false - message was queued for later sending
- See Also:
-
sendMessage
Description copied from interface:FIXSession
Convenient method to send out user built FIX message. Depending on implementation and configuration may send message immediately or put it in the outgoing queue either persistent or stateless. The Engine updates the footer and header in themessage
.If session is disposed no more messages should be send by session.
- Specified by:
sendMessage
in interfaceFIXSession
- Parameters:
message
- the messageoptionMask
-FIXSession.SEND_SYNC
orFIXSession.SEND_ASYNC
- Returns:
- true if message was send immediately, false - message was queued for later sending
-
sendMessageAndGetQueueSize
Description copied from interface:ExtendedFIXSession
Do the same thatFIXSession.sendMessage(FIXFieldList, int)
and return queue size.- Specified by:
sendMessageAndGetQueueSize
in interfaceExtendedFIXSession
- Returns:
- queue size. 0 if message was send synchronously
- See Also:
-
sendMessageOutOfTurn
Description copied from interface:ExtendedFIXSession
Sends message out of turn.- Specified by:
sendMessageOutOfTurn
in interfaceExtendedFIXSession
- Parameters:
type
- the message typemessage
- the message- Returns:
- true if message was send immediately, false - message was queued for later sending
- See Also:
-
getMessageValidator
Description copied from interface:FIXSession
Returns message validator.- Specified by:
getMessageValidator
in interfaceFIXSession
- Returns:
- message validator for current session
- See Also:
-
dispose
public void dispose()Description copied from interface:FIXSession
Disposes current session, removes its reference from GlobalSessionManager and frees all allocated resources. Normally should be called after disconnect(). However it is possible to call this method for active session without previous disconnect() that will abnormally terminate fix session by closing fix connection (without logon exchange). This is useful to terminate stuck sessions if standard FIX logoff procedure doesn't work.- Specified by:
dispose
in interfaceFIXSession
- See Also:
-
sendTestRequest
protected void sendTestRequest()Send test request. -
checkHasSessionSendOrReceivedTestRequest
public void checkHasSessionSendOrReceivedTestRequest()The method checks if TR send or received.If session is not received any messages during HB interval the HB will be send and If no response received session will be disconnected;
This is helper method for session task.
-
checkSessionInactiveAndSendHbt
public void checkSessionInactiveAndSendHbt() -
disconnectTestRequestIsLost
protected void disconnectTestRequestIsLost()Disconnect the session if test request doesn't received. -
restoreSessionAfterReceivedTestRequest
protected void restoreSessionAfterReceivedTestRequest()Restore the session if test request is received. -
resetTestRequestFlags
protected void resetTestRequestFlags() -
setAttribute
public void setAttribute(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr, long value) - Specified by:
setAttribute
in interfaceExtendedFIXSession
-
removeAttribute
public void removeAttribute(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr) -
removeLongAttribute
public void removeLongAttribute(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr) -
getAttributeAsLong
public long getAttributeAsLong(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr) - Specified by:
getAttributeAsLong
in interfaceExtendedFIXSession
-
setAttribute
public void setAttribute(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr, boolean value) - Specified by:
setAttribute
in interfaceExtendedFIXSession
-
getAttributeAsBool
public boolean getAttributeAsBool(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr) - Specified by:
getAttributeAsBool
in interfaceExtendedFIXSession
-
setAttribute
Description copied from interface:ExtendedFIXSession
Sets session attribute.- Specified by:
setAttribute
in interfaceExtendedFIXSession
- Parameters:
key
- the attribute keyvalue
- the attribute value- See Also:
-
setAttribute
- Specified by:
setAttribute
in interfaceExtendedFIXSession
-
getAttribute
Description copied from interface:ExtendedFIXSession
Gets session attribute value.- Specified by:
getAttribute
in interfaceExtendedFIXSession
- Parameters:
key
- the attribute key- Returns:
- attribute value
- See Also:
-
getAttribute
- Specified by:
getAttribute
in interfaceExtendedFIXSession
-
removeAttribute
Description copied from interface:ExtendedFIXSession
Removes session attribute.- Specified by:
removeAttribute
in interfaceExtendedFIXSession
- Parameters:
key
- the attribute key- See Also:
-
subscribeForAttributeChanges
public void subscribeForAttributeChanges(com.epam.fixengine.session.ExtendedFIXSessionAttribute attr, com.epam.fixengine.session.ExtendedFIXSessionAttributeListener listener) - Specified by:
subscribeForAttributeChanges
in interfaceExtendedFIXSession
-
addSessionStateListener
public void addSessionStateListener(com.epam.fixengine.session.FIXSessionStateListener stateListener) - Specified by:
addSessionStateListener
in interfacecom.epam.fixengine.session.SessionStateListenSupport
-
removeSessionStateListener
public void removeSessionStateListener(com.epam.fixengine.session.FIXSessionStateListener stateListener) - Specified by:
removeSessionStateListener
in interfacecom.epam.fixengine.session.SessionStateListenSupport
-
toString
-
equals
-
hashCode
public int hashCode() -
getEncryption
public com.epam.fixengine.encryption.Encryption getEncryption()- Specified by:
getEncryption
in interfaceExtendedFIXSession
-
setLastDisconnectReason
-
getLastDisconnectReason
- Specified by:
getLastDisconnectReason
in interfaceExtendedFIXSession
-
backupStorages
- Throws:
IOException
-
setInSeqNum
- Specified by:
setInSeqNum
in interfaceFIXSession
- Throws:
IOException
-
setOutSeqNum
- Specified by:
setOutSeqNum
in interfaceFIXSession
- Throws:
IOException
-
getInSeqNum
public long getInSeqNum()- Specified by:
getInSeqNum
in interfaceFIXSession
-
getOutSeqNum
public long getOutSeqNum()- Specified by:
getOutSeqNum
in interfaceFIXSession
-
getMessageValidator
Description copied from interface:FIXSession
Returns message validator by appVersion.- Specified by:
getMessageValidator
in interfaceFIXSession
- Returns:
- message validator by appVersion
-
getMessageValidator
Description copied from interface:FIXSession
Returns message validator by appVersion. Validates for compliance with the basic version- Specified by:
getMessageValidator
in interfaceFIXSession
- Parameters:
newAppVersion
- - appVersion from messagebaseFixVersion
- - base version for appVersion from message/session- Returns:
- message validator by appVersion
-