|
||||||||||
| PREV CLASS NEXT CLASS | All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.teraspaces.qwfix.FIXEngine
public final class FIXEngine
| Field Summary | |
|---|---|
static int |
CACHE_CAPACITY_ALL
|
| Method Summary | |
|---|---|
void |
addEngineListener(FIXEngineListener listener)
Adds the engine event listener. |
static int |
getCacheCapacity()
Gets the cache capacity. |
static FIXEngineMessageCacheType |
getCacheType()
Gets the cache type. |
FIXEngineMessageHandler |
getEngineMessageHandler(FIXSession session,
String msgType)
Gets the engine message handler for the specified MsgType and FIXSession. |
String |
getEngineName()
Gets the engine name. |
FIXEnginePersistenceStateInfo |
getEnginePersistenceStateInfo()
Gets the engine persistence state info. |
FIXEngineRole |
getEngineRole()
Gets role of current engine. |
int |
getGlobalEngineID()
Gets the index of the current engine in getGlobalEngines(). |
static List<FIXEngine> |
getGlobalEngines()
Gets the global list of all FIX engines managed by current process. |
static List<FIXSessionPersistence> |
getGlobalSessionPersistences()
Get the global list of FIXSessionPersistence in the current process. |
static List<FIXSession> |
getGlobalSessions()
Gets the global session list. |
static FIXMessage |
getMessage(long token)
Gets the engine message. |
FIXEngineMessageHandlerStatus |
getMessageHandlerStatus()
Gets the message handler status. |
FIXMessageLog |
getMessageLog()
Gets the engine message log. |
FIXServiceStatus |
getServiceStatus()
Gets the current service status. |
FIXSession |
getSession(String name,
FIXSessionDirection direction)
Gets a session specified by name and direction. |
List<FIXSessionPersistence> |
getSessionPersistences()
Gets the list of FIXSessionPersistence managed by current engine. |
List<FIXSession> |
getSessions()
Gets the complete list of sessions defined in the engine. |
FIXEngineSettings |
getSettings()
Gets the settings. |
static void |
initMessageCache(FIXEngineMessageCacheType cacheType,
int cacheCapacity)
Initializes the global FIXMessage cache with a specified capacity. |
void |
removeEngineListener(FIXEngineListener listener)
Removes the specified engine event listener. |
void |
setEngineMessageDefaultHandler(FIXSession session,
FIXEngineMessageHandler handler)
Sets a default message handler for the specific session. |
void |
setEngineMessageHandler(FIXSession session,
FIXEngineMessageHandler handler,
String... msgTypes)
Sets a message handler for the specific session. |
static void |
unloadAll()
Unloads all FIXEngine instances in the current process. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CACHE_CAPACITY_ALL
| Method Detail |
|---|
public static void initMessageCache(FIXEngineMessageCacheType cacheType,
int cacheCapacity)
Initializes the global FIXMessage cache with a specified capacity.
The global message cache is not bounded with the FIXEngine. An process can only have one message cache while it can have more than one FIXEngines.
The cacheCapacity can be either the number of messages or number of "MegaBytes (MB)" of memory, depending on the value of cacheType.
cacheType - the type of cache.cacheCapacity - the cache capacity. Use CACHE_CAPACITY_ALL for unlimited capacity.getCacheCapacity(),
getCacheType()public static int getCacheCapacity()
Gets the cache capacity. The cacheCapacity can be either the number of messages or number of "MegaBytes (MB)" of memory, depending on the value of cacheType.
initMessageCache(FIXEngineMessageCacheType, int),
getCacheType()public static FIXEngineMessageCacheType getCacheType()
initMessageCache(FIXEngineMessageCacheType, int),
getCacheCapacity(),
FIXEngineMessageCacheTypepublic FIXEngineSettings getSettings()
FIXStandaloneApplicationListener.engineInitialized(FIXEngine) for more detail.
public static void unloadAll()
Unloads all FIXEngine instances in the current process.
After this method is called, all QWFIX related resources should be freed and subject to garbage collection.
public void setEngineMessageHandler(FIXSession session,
FIXEngineMessageHandler handler,
String... msgTypes)
Sets a message handler for the specific session.
The handler must be able to handle Reject message. A reject message against a message type in the list will be passed to the handler, too.
If a FIXSession does not specify a handler for a specific MsgType, the default handler
(see setEngineMessageDefaultHandler(FIXSession, FIXEngineMessageHandler)) will be used.
If the default handler is not specific either, the message is ignored. No error will be reported.
It's application developers' responsibility to at least specify the default handler.
It's application developers' responsibility to implement their own FIXEngineMessageHandler,
based on their own business logics. QWFIX system may provide some standard off-the-shelf handlers for
some common business logics such as order handling and market data.
session - the FIX session.handler - the message handlermsgTypes - the types of messages the handler is going to handlesetEngineMessageDefaultHandler(FIXSession, FIXEngineMessageHandler)
public void setEngineMessageDefaultHandler(FIXSession session,
FIXEngineMessageHandler handler)
Sets a default message handler for the specific session.
This handler will handle message types not covered by setEngineMessageDefaultHandler(FIXSession, FIXEngineMessageHandler)
, including "unexpected" message types.
The default handler will handle the message if not other handler for the MsgType of the specified FIX message is found. See
setEngineMessageHandler(FIXSession, FIXEngineMessageHandler, String...) for more details.
session - the FIX sessionhandler - the handler
public FIXEngineMessageHandler getEngineMessageHandler(FIXSession session,
String msgType)
FIXSession.
The returned handler may be null, which indicates that the handler has not been specified for the session.
session - the sessionmsgType - the MsgType
public FIXSession getSession(String name,
FIXSessionDirection direction)
name - the namedirection - the direction
public List<FIXSession> getSessions()
Gets the complete list of sessions defined in the engine. The returned list is read only.
Sessions defined in a FIXEngine can be accessed using "EngineSessionID" (see FIXSession.getEngineSessionID() as index.
Note the EngineSessionID is only valid within the process life cycle. It is not guaranteed to be
the same across different process life spans.
FIXSession.getEngineSessionID(),
getGlobalSessions()public String getEngineName()
public FIXServiceStatus getServiceStatus()
public FIXEnginePersistenceStateInfo getEnginePersistenceStateInfo()
public FIXEngineRole getEngineRole()
public List<FIXSessionPersistence> getSessionPersistences()
Gets the list of FIXSessionPersistence managed by current engine.
The FIXSessionPersistence.getEnginePersistenceID() returns the index of the persistence in this list.
The returned list is read only.
getGlobalSessionPersistences()public static List<FIXSessionPersistence> getGlobalSessionPersistences()
Get the global list of FIXSessionPersistence in the current process.
This method get all session persistence managed by current process. If there's only one FIXEngine in process.
The list should be the same as getSessionPersistences(); otherwise it will be a collection of all
SessionPersistences of all engines.
The returned list is read only.
getSessionPersistences()public void addEngineListener(FIXEngineListener listener)
listener - the listenerpublic void removeEngineListener(FIXEngineListener listener)
listener - the listenerpublic static FIXMessage getMessage(long token)
Gets the engine message.
The FIX engine message cache is a global LRU (Least Recently Used) cache. This operation will affect the cache by moving the message to the head of the cache (unless the cache size is unlimited).
The message may return a null if message is not available. For example, a token may represent an incoming administrative message that was "skipped" during resend process from a "Resend Gap Fill".
token - the token
public FIXMessageLog getMessageLog()
The MessageLog keeps all FIX application message communications throughout the current FIXEngine life cycle (controlled by FIXScheduler). Administrative messages are generally hidden from application and will not be included in this log. The only exception is the "Reject" messages against application messages. Those "Reject" messages will be included in the log.
The MessageLog is read only. Throughout the life cycle of the FIXEngine, the size of log will only increase as a result of new messages appended to the log.
The messages in the log are appended in the order of the time the message is "processed" by the system.
For incoming messages, the message is appended to the log at the time of after the message is processed by FIXSession (by passing the message to the (@link FIXEngineMessageHandler} associated with the corresponding FIXSession, not the time when the message was received by FIXSession.
For outgoing messages, the message is appended to the log immediately after the message was sent by calling
FIXSession.sendMessage(com.teraspaces.qwfix.FIXMessage), not the time when the message is actually sent by the session to the peer.
In the remote monitoring tools or QWFIX hot standby backup servers, the MessageLog is automatically synchronized with that of the primary production server. Remote applications can use the remote copy of MessageLog to help replicating the state of the primary production server. (See QWFIX RTAnalyzer)
public FIXEngineMessageHandlerStatus getMessageHandlerStatus()
The status may be Recovery.
public int getGlobalEngineID()
getGlobalEngines().
Usually application only need one instance of FIXEngine per process. In that case the GlobalEngineID will be 0 and the count of GlobalEngines will be 1.
One exception is the management tool. The management tool such as QWFIX RTAnalyzer may maintain more than one FIXEngine per process.
getGlobalEngines()public static List<FIXEngine> getGlobalEngines()
Each FIXEngine has a property getGlobalEngineID() represents the index of the FIXEngine in this list.
Usually application only need one instance of FIXEngine per process. In that case the GlobalEngineID will be 0 and the count of GlobalEngines will be 1.
One exception is the management tool. The management tool such as QWFIX RTAnalyzer may maintain more than one FIXEngine per process.
If the process does manage more than one FIX engines. The GlobalEngines collection is only valid during run-time. If the system is shut down and restarted, the sequence of FIX engines in GlobalEngines may possibly change because the engines may be added by different threads. In that case the GlobalEngineID of each engine will change accordingly.
getGlobalSessions()public static List<FIXSession> getGlobalSessions()
The system may manage more than one FIX engines in the same process. The GUI based management tool QWRTAnalyzer is a good example. The glbal session list contains all FIX sessions managed by the system.
FIXSession.getGlobalSessionID() is the index of the session in this list.
If the process does manage more than one FIX engines. The GlobalSessions collection is only valid during run-time. If the system is shut down and restarted, the sequence of FIX sessions in GlobalSessions may possibly change because the sessions may be added by different threads. In that case the GlobalSessionID of each session will change accordingly.
getSessions(),
FIXSession.getGlobalSessionID(),
getGlobalEngines()
|
||||||||||
| PREV CLASS NEXT CLASS | All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||