Package com.btobits.fixengine
Interface FIXEngine
- All Known Implementing Classes:
FIXEngineB2B
public interface FIXEngine
Interface for FIXEngine-Application interaction
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventListener
(String sessionID, EventListener eventListener) Adds event listener for listening specified session.void
addGlobalEventListener
(EventListener eventListener) Adds global event listener for listening all sessions.void
Closes engine.void
closeEngineSession
(String sessionID) Closes session with specified ID.void
closeEngineSession
(String sessionID, String reason) Closes session with specified ID.connectToRemoteFIXEngine
(String connectionString) Establishes connection with remote FIX Engine.connectToRemoteFIXEngine
(String connectionString, int heartBtInt, String senderCompID, String targetCompID, int encryptionType) Establishes connection with remote FIX Engine.connectToRemoteFIXEngine
(String connectionString, int heartBtInt, String senderCompID, String targetCompID, int encryptionType, int startFromSeqNum) Establishes connection with remote FIX Engine.connectToRemoteFIXEngine
(String connectionString, StdHdrParamStruct stdHdrParamStruct, LogonParamStruct logonParamStruct, int startFromSeqNum) Establishes connection with remote FIX Engine.getFIXVersionBySessionID
(String sessionID) Gets the FIX Protocol version ID for specified session.int
getHeartbeatIntervalBySessionID
(String sessionID) Gets the FIX Protocol version ID for specified session.int
getIncomingSequenceBySessionID
(String sessionID) Gets incoming sequence number for session with indicated sessionID.getMessageFromMessageStore
(MessageDirection messageType, long seqNum, String sessionID) Retrieves FIX Message from the Message Storage.int
getOutgoingSequenceBySessionID
(String sessionID) Gets outgoing sequence number for session with indicated sessionID.getSenderCompIDbySession
(String sessionID) Gets SenderCompID of session with specified ID.getSessionIDbyCompIDs
(String senderCompID, String targetCompID) Gets session ID by senderCompID and targetCompID.getTargetCompIDbySession
(String sessionID) Gets TargetCompID of session with specified ID.boolean
isSessionActive
(String sessionID) Checks if session is online.void
registerApplication
(Application application) Registers application in FIX Engine instance.boolean
removeEventListener
(String sessionID, EventListener eventListener) Removes event listener for listening specified session.boolean
removeGlobalEventListener
(EventListener eventListener) Removes global event listener for listening all session.void
sendMessage
(FIXMessage message, String sessionID) Put FIX message message to queue for sending to remote FIX Engine.void
sendMessageOutOfTurn
(FIXMessage message, String sessionID) Send FIXMessage to remote FIX Engine rigth now.void
Unregisters application in FIX Engine instance.
-
Method Details
-
registerApplication
Registers application in FIX Engine instance.- Parameters:
application
- the application, which will process application messages from remote FIX Engine.
-
unregisterApplication
void unregisterApplication()Unregisters application in FIX Engine instance. -
addEventListener
Adds event listener for listening specified session.- Parameters:
sessionID
- the ID of session, which will be listened.eventListener
- the event listener implementation.
-
addGlobalEventListener
Adds global event listener for listening all sessions.- Parameters:
eventListener
- the event listener implementation.
-
removeEventListener
Removes event listener for listening specified session.- Parameters:
sessionID
- the ID of session, which will be listened.eventListener
- the event listener implementation.
-
removeGlobalEventListener
Removes global event listener for listening all session.- Parameters:
eventListener
- the event listener implementation.
-
connectToRemoteFIXEngine
Establishes connection with remote FIX Engine.Connection string must be formatted in the following way:
< protocol > < subprotocol > :// < host > : < port >
< protocol > ::= fix42
< subprotocol > ::= tcp- Parameters:
connectionString
- the connestion string.- Returns:
- ID of created session.
- Throws:
EngineNotFoundException
- if connection cannot be created or logon respose is not received in pre-configured timeout interval.
-
connectToRemoteFIXEngine
String connectToRemoteFIXEngine(String connectionString, int heartBtInt, String senderCompID, String targetCompID, int encryptionType) throws EngineNotFoundException Establishes connection with remote FIX Engine. Connection string must be formatted in the following way:
< protocol > < subprotocol > :// < host > : < port >
< protocol > ::= fix42
< subprotocol > ::= tcp- Parameters:
heartBtInt
- the value of Heartbeat interval in seconds, which will be placed in InitialProcess messagesenderCompID
- the SenderCompID, which will be placed in messages headerstargetCompID
- the TargetCompID, which will be placed in messages headersencryptionType
- the type of encryption.- Returns:
- ID of created session
- Throws:
EngineNotFoundException
- if connection cannot be created or logon respose is not received in pre-configured timeout interval.
-
connectToRemoteFIXEngine
String connectToRemoteFIXEngine(String connectionString, int heartBtInt, String senderCompID, String targetCompID, int encryptionType, int startFromSeqNum) throws EngineNotFoundException Establishes connection with remote FIX Engine. Connection string must be formatted in the following way:
< protocol > < subprotocol > :// < host > : < port >
< protocol > ::= fix42
< subprotocol > ::= tcp- Parameters:
heartBtInt
- Value of Heartbeat interval in seconds, which will be placed in InitialProcess messagesenderCompID
- the SenderCompID, which will be placed in messages headerstargetCompID
- the TargetCompID, which will be placed in messages headersencryptionType
- the type of encryption.startFromSeqNum
- the starting outgoing sequence number.- Returns:
- ID of created session
- Throws:
EngineNotFoundException
- if connection cannot be created or logon respose is not received in pre-configured timeout interval.
-
connectToRemoteFIXEngine
String connectToRemoteFIXEngine(String connectionString, StdHdrParamStruct stdHdrParamStruct, LogonParamStruct logonParamStruct, int startFromSeqNum) throws EngineNotFoundException Establishes connection with remote FIX Engine.- Parameters:
stdHdrParamStruct
- structure, which contains Standard Message Header parameterslogonParamStruct
- structure, which contains InitialProcess Message parameters- Returns:
- ID of created session
- Throws:
EngineNotFoundException
- if connection cannot be created or logon respose is not received in pre-configured timeout interval.
-
getSenderCompIDbySession
Gets SenderCompID of session with specified ID.- Parameters:
sessionID
- session ID- Throws:
SessionNotFoundException
- if session cannot be found.
-
getSessionIDbyCompIDs
String getSessionIDbyCompIDs(String senderCompID, String targetCompID) throws SessionNotFoundException Gets session ID by senderCompID and targetCompID.- Parameters:
senderCompID
- senderCompIDtargetCompID
- targetCompID- Returns:
- session ID string
- Throws:
SessionNotFoundException
- if session cannot be found.
-
getTargetCompIDbySession
Gets TargetCompID of session with specified ID.- Parameters:
sessionID
- the session ID string- Throws:
SessionNotFoundException
- if session cannot be found.
-
getFIXVersionBySessionID
Gets the FIX Protocol version ID for specified session.- Parameters:
sessionID
- the session ID.- Returns:
- the connection protocol version id string: fix40, fix41, fix42, fix43 or fix44.
- Throws:
Exception
- if the version cannot be retrieved.
-
getHeartbeatIntervalBySessionID
Gets the FIX Protocol version ID for specified session.- Parameters:
sessionID
- the session ID.- Returns:
- the heartbeat interval in seconds.
- Throws:
Exception
- if the heartbeat interval cannot be retrieved.
-
isSessionActive
Checks if session is online.- Parameters:
sessionID
- the session ID string.- Returns:
- true if session is online.
- Throws:
Exception
- if session cannot be found.
-
getIncomingSequenceBySessionID
Gets incoming sequence number for session with indicated sessionID.- Parameters:
sessionID
- the ID of session.- Throws:
Exception
- if the incoming sequence number cannot be retrieved.
-
getOutgoingSequenceBySessionID
Gets outgoing sequence number for session with indicated sessionID.- Parameters:
sessionID
- the ID of session.- Throws:
Exception
- if the outgoing sequence number cannot be retrieved.
-
sendMessage
Put FIX message message to queue for sending to remote FIX Engine.- Parameters:
message
- the message to be sent.sessionID
- the ID of session in which message will be sent.- Throws:
ApplMessageTransmitException
- if the message cannot be sent to the counterparty.
-
sendMessageOutOfTurn
Send FIXMessage to remote FIX Engine rigth now.- Parameters:
message
- the message to be sent in FIXMessage formatsessionID
- the ID of session in which message will be sent- Throws:
ApplMessageTransmitException
- if the message cannot be sent to the counterparty.
-
getMessageFromMessageStore
FIXMessage getMessageFromMessageStore(MessageDirection messageType, long seqNum, String sessionID) throws Exception Retrieves FIX Message from the Message Storage.- Parameters:
messageType
- the type of message (1 - incoming, 2 - outgoing)seqNum
- the sequence number of the message.sessionID
- the ID of session, from which the message will be retrieved.- Returns:
- the retrieved connection message.
- Throws:
Exception
- if message cannot be retrieved or parsed.
-
closeEngineSession
Closes session with specified ID.- Parameters:
sessionID
- closing session ID- Throws:
SessionNotFoundException
- if the session cannot be found or properly closed.
-
closeEngineSession
Closes session with specified ID.- Parameters:
reason
- the reason string that will be sent as text field value (tag=58) of logout message.- Throws:
SessionNotFoundException
- if the session cannot be found or properly closed.
-
closeEngine
Closes engine.- Throws:
Exception
- if the FIX Engine cannot be properly closed.
-