com.teraspaces.qwfix
Class FIXMessage

java.lang.Object
  extended by com.teraspaces.qwfix.FIXMessageComponent
      extended by com.teraspaces.qwfix.FIXMessage

public abstract class FIXMessage
extends FIXMessageComponent

Represents a FIX message.


Constructor Summary
FIXMessage()
           
 
Method Summary
abstract  void free()
          Returns this instance to QWFIX run time object cache.
abstract  FIXMessageDirection getDirection()
          Gets the direction.
 FIXSchemaMessage getMessageSchema()
          Gets the message schema.
abstract  long getMessageToken()
          Gets the message token.
 String getMsgType()
          Gets the MsgType.
abstract  void verify()
          Verifies this message.
 
Methods inherited from class com.teraspaces.qwfix.FIXMessageComponent
clear, containsTag, copyTo, createMultipleValueString, createMultipleValueString, createRepeatingGroup, createRepeatingInstance, getBooleanValue, getBooleanValue, getBooleanValueAt, getCharValue, getCharValue, getCharValueAt, getDataValue, getDataValue, getDataValueAt, getDateTimeBinaryValue, getDateTimeBinaryValue, getDateTimeBinaryValueAt, getDateTimeValue, getDateTimeValue, getDateTimeValueAt, getFieldCount, getFieldIndex, getFieldSchemaAt, getFloatValue, getFloatValue, getFloatValueAt, getIntValue, getIntValue, getIntValueAt, getMessageComponentSchema, getMultipleValueString, getMultipleValueString, getMultipleValueStringAt, getNativeValue, getNativeValue, getNativeValueAt, getRepeatingGroup, getRepeatingGroupSchema, getSession, getSessionOptions, getSessionPersistence, getSessionSchemaIndex, getStringValue, getStringValue, getStringValueAt, getTimeOnlyBinaryValue, getTimeOnlyBinaryValue, getTimeOnlyBinaryValueAt, getTimeOnlyValue, getTimeOnlyValue, getTimeOnlyValueAt, getTZTimeOnlyValue, getTZTimeOnlyValue, getTZTimeOnlyValueAt, getTZTimestampValue, getTZTimestampValue, getTZTimestampValueAt, removeField, removeFieldAt, removeRepeatingGroup, setEncodedDataValue, setRepeatingGroup, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIXMessage

public FIXMessage()
Method Detail

getMsgType

public String getMsgType()
Gets the MsgType.

Returns:
the MsgType

verify

public abstract void verify()
                     throws FIXSessionRejectException
Verifies this message.

If this method returns without throwing an exception, the FIXSession won't throw FIXSessionRejectException when the application sends the message later on using FIXSession.sendMessage(com.teraspaces.qwfix.FIXMessage).

This method only makes sure that the message meets the most basic requirement of the FIXMessage verification rules. In practice only the required fields rule is checked. There's no need to check the valid values rule because it's already checked when FIXMessageComponent.setValue(int, int) is called.

QWFIX Engine won't check the "conditionally required fields". Visual Lambda rules can be defined and added to engine session to enforce such rules. This method does check Visual Lambda rules. This method only makes sense for non-readonly type of messages. Read only type of FIX messages always returns successfully.

Event if a message passes this verification, other exceptions may be thrown out when calling sendMessage. For example, the session may be down or disabled. This method won't guarantee that the message won't be rejected by counter party, either.

Usually there's no need to call this method because the message is always verified when message is passed to sendMessage. The only scenario that the message needs to be called is when application needs to send more than one messages in a "Transaction" context, for example, a list of segmented message (such as "New Order - List").

Throws:
FIXSessionRejectException - the FIX session reject exception

getMessageSchema

public FIXSchemaMessage getMessageSchema()
Gets the message schema.

Returns:
the message schema

getDirection

public abstract FIXMessageDirection getDirection()
Gets the direction.

Returns:
the direction

getMessageToken

public abstract long getMessageToken()
Gets the message token.

Returns:
the message token

free

public abstract void free()
Returns this instance to QWFIX run time object cache.

This method is called when the message instance created by FIXSession.createMessage(String) is no longer needed.

Modifying the instance after this method is called will lead to undetermined behavior.

This method will return the message to the run time maintained "FIX message cache", so that the instance will be reused when another CreateMessage()()() is called. Using the method will save unnecessary memory allocation and unnecessary garbage collection and improve the system overall performance.

If the message is discarded without calling this method, the message will finally subject to garbage collection.

Calling FIXMessageComponent.clear() method on the message will recycle every repeating instances contained by the message. The message can be reused immediately. In fact this method also triggers a clear() method call.

Calling this method more than once on the same FIXMessage instance may lead to disastrous result. For performance reason we don't check such behavior in our code. It's developers' responsibility to prevent it.

Calling free() on a read only message will do nothing. Read only messages are managed by internal message cache.