com.teraspaces.qwfix
Interface FIXRemoteReplicatorEngineCallBack


public interface FIXRemoteReplicatorEngineCallBack

Defines a mechanism for application to interact with the FIXRemoteReplicatorApplication.


Method Summary
 void engineInitialized(FIXEngine engine, int remoteEngineMessageCount)
          This method is called when the FIXRemoteReplicatorApplication initialized a local instance of the remote FIXEngine.
 void engineResumed(FIXEngine engine, int remoteEngineMessageCount)
          This method is called when the the local instance of the remote engine is resumed.
 void engineStopped(FIXEngine engine)
          Called when the remote engine is stopped.
 FIXRemoteReplicatorSessionSettings[] getSyncSettings(FIXEngine engine)
          Gets the sync settings.
 void messageCountUpdated(FIXEngine engine, int remoteEngineMessageCount)
          This method is called when the total message count of the remote FIX engine changes.
 void newPersistenceCreated(FIXEngine engine)
          Notifies that a new instance of FIXSessionPersistence is created in the remote FIX engine.
 void outgoingMessageDelivered(FIXEngine engine, FIXSessionPersistence persistence, long messageToken, int actualMsgSeqNum)
          This method is called when a new outgoing message is actually sent over the wire in the remote system.
 void postProcessMessage(FIXEngine engine, FIXMessage message, int localEngineMessageIndex, int remoteEngineMessageCount)
          Called after the message has been processed by the session message handler.
 void preProcessMessage(FIXEngine engine, FIXMessage message)
          Called when a message is just received by the local application but has not been "processed" by the session message handler.
 

Method Detail

engineInitialized

void engineInitialized(FIXEngine engine,
                       int remoteEngineMessageCount)
This method is called when the FIXRemoteReplicatorApplication initialized a local instance of the remote FIXEngine.

The remoteEngineMessageCount is the total message count of the remote FIX engine, not the message count of local copy (which is FIXEngine.getMessageLog().size()).

Because all message communication of the remote FIX engine will be synchronized to the local copy, there will be a slight time delay, depending on the system performance. The value of remoteEngineMessageCount the application received may not be the actual message count of the remote engine (remote application may send or receive more messages during the "synchronization" process).

"Remote application" refers to the remote QWFIX enabled process running in production mode. "Local application" meaning the local system running in the "replication" mode that synchronizes the FIX message communication from the remote system over the network and "replay" the messages in order to reconstruct the business logic locally.

Parameters:
engine - The local instance of remote FIX engine.
remoteEngineMessageCount - the current total message count of the remote FIX engine.

engineResumed

void engineResumed(FIXEngine engine,
                   int remoteEngineMessageCount)
This method is called when the the local instance of the remote engine is resumed.

The local instance of FIX engine will cache as many messages from the remote engine as possible to local storage. Imagine the following scenario: The application started to synchronize with the remote production process by retrieveing FIX messages from the remote process. Then the local process is shut down. Later we bring the local process back up, the local process will first do "recovery" by replaying the FIX message communication from the local message persistence, it will then connect to remote process and try to "catch up" the new messages.

"Remote application" refers to the remote QWFIX enabled process running in production mode. "Local application" meaning the local system running in the "replication" mode that synchronizes the FIX message communication from the remote system over the network and "replay" the messages in order to reconstruct the business logic locally.

Parameters:
engine - The local instance of remote FIX engine.
remoteEngineMessageCount - the current total message count of the remote FIX engine.

engineStopped

void engineStopped(FIXEngine engine)
Called when the remote engine is stopped. A remote engine is considered stopped if it is disconnected and the local scheduler reports an "life cycle expiration".

"Remote application" refers to the remote QWFIX enabled process running in production mode. "Local application" meaning the local system running in the "replication" mode that synchronizes the FIX message communication from the remote system over the network and "replay" the messages in order to reconstruct the business logic locally.

Parameters:
engine - the engine

preProcessMessage

void preProcessMessage(FIXEngine engine,
                       FIXMessage message)
Called when a message is just received by the local application but has not been "processed" by the session message handler.

"Remote application" refers to the remote QWFIX enabled process running in production mode. "Local application" meaning the local system running in the "replication" mode that synchronizes the FIX message communication from the remote system over the network and "replay" the messages in order to reconstruct the business logic locally.

If the message is a rejected incoming message or outgoing reject. preProcessMessage and postProcessMessage(FIXEngine, FIXMessage, int, int) will be called. However, the business logic message handler will not be called.

Parameters:
engine - the local instance of the remote FIX engine
message - the FIX message

postProcessMessage

void postProcessMessage(FIXEngine engine,
                        FIXMessage message,
                        int localEngineMessageIndex,
                        int remoteEngineMessageCount)
Called after the message has been processed by the session message handler.

Value of localEngineMessageIndex should be equal to FIXEngine.getMessageLog().size() of the local FIX engine, while value of remoteEngineMessageCount is the FIXEngine.getMessageLog().size() of the remote FIX engine. If those two values are not equal, we know there are some communication delay.

If localEngineMessageIndex and remoteEngineMessageCount are equal, our local message log "catches up" with the remote FIX engine. We can use those two values to tell if we have down loaded all FIX messages from the remote.

"Remote application" refers to the remote QWFIX enabled process running in production mode. "Local application" meaning the local system running in the "replication" mode that synchronizes the FIX message communication from the remote system over the network and "replay" the messages in order to reconstruct the business logic locally.

If the message is a rejected incoming message or outgoing reject. preProcessMessage and postProcessMessage(FIXEngine, FIXMessage, int, int) will be called. However, the business logic message handler will not be called.

Parameters:
engine - the local instance of the remote FIX engine
message - the FIX message
localEngineMessageIndex - index of the local engine message log
remoteEngineMessageCount - the remote engine message count

messageCountUpdated

void messageCountUpdated(FIXEngine engine,
                         int remoteEngineMessageCount)
This method is called when the total message count of the remote FIX engine changes.

This method is only called if the current FIXRemoteReplicatorApplication does not want to synchronize all FIX sessions in remote process. In that case if there are some FIX message communication happened in the unwanted FIX sessions, the FIXEngine.MessageLog.Count of the remote engine will be changed. Because the current application is not interested in that session. FIX message will not be transmitted over the network. Only the message count will be updated.

If this happens, the corresponding entry in the MessageLog of the current FIX engine will be set to FIXMessageTokenHelper.NULL_TOKEN.

Parameters:
engine - the engine
remoteEngineMessageCount - the remote engine message count

getSyncSettings

FIXRemoteReplicatorSessionSettings[] getSyncSettings(FIXEngine engine)
Gets the sync settings.

Parameters:
engine - the engine
Returns:
the sync settings

newPersistenceCreated

void newPersistenceCreated(FIXEngine engine)
Notifies that a new instance of FIXSessionPersistence is created in the remote FIX engine. As result, a corresponding instance of FIXSessionPersistence will be created locally.

In order to get the newly created instances of FIXSessionPersistence. Application needs to inspect FIXEngine.getSessionPersistences().

Note if the engine contains a session that supports "24 hour reset session". A new instance of FIXSessionPersistence will be created for every 24 hours (depending on the scheduler) on the remote process. As result, this method will be called immediately after the new remote persistence is created.

"Remote application" refers to the remote QWFIX enabled process running in production mode. "Local application" meaning the local system running in the "replication" mode that synchronizes the FIX message communication from the remote system over the network and "replay" the messages in order to reconstruct the business logic locally.

Parameters:
engine - the engine

outgoingMessageDelivered

void outgoingMessageDelivered(FIXEngine engine,
                              FIXSessionPersistence persistence,
                              long messageToken,
                              int actualMsgSeqNum)
This method is called when a new outgoing message is actually sent over the wire in the remote system.

Parameters:
engine - the local instance of the remote FIX engine
persistence - the persistence the message belongs to
messageToken - the message token
actualMsgSeqNum - the actual "MsgSeqNum" assigned to the message