forwardEstablishing FIX Connection via Proxy   Table of ContentFIX Messagingforward
FlatMessage Mode
FlatMessage Mode

Sometimes it is more convenient to work with FIX messages just as sequences of tag=value pairs. For example, an application needs to receive a message, access a few fields, and use the value of these fields to route the message to one of the counterparties (so-called "FIX to FIX routing"). In this scenario, it could be impractical to maintain the FIX Dictionary - especially if messages are received from venues that use different FIX Dictionaries. To support this scenario, the Engine exposes the FlatMessage class.

Receiving Flat Messages

To receive Flat Messages, set SessionMessageMode property to 'FlatMessage'. In this mode, The 'args.FlatMsg' member is filled in inbound callbacks by the FlatMessage instance:

class SessionListener
  public void OnInboundApplicationMsg(Object sender, InboundApplicationMsgEventArgs args)
    // The 'args.Msg' is filled when the 'Message' mode is used (by default).
    Console.WriteLine("Incoming application-level message: {0}", args.Msg);

    // The 'args.FlatMsg' is filled when the 'FlatMessage' mode is used.
    Console.WriteLine("Incoming application-level message: {0}", args.FlatMsg);

SessionListener listener = new SessionListener();
Session initiator = new Session("targetCompID", "senderCompID", ProtocolVersion.FIX44);

// In this mode, 'args.FlatMsg' is filled in inbound session events.
initiator.MessageMode = SessionMessageMode.FlatMessage;

initiator.InboundApplicationMsgEvent += new InboundApplicationMsgEventHandler(listener.OnInboundApplicationMsg);

// Work with the session as usual.

Sending Flat Messages

To send Flat Messages, use the corresponding Send(FlatMessage) method.

FlatMessage versus Message

Message Supports validation. Fields order is defined by the FIX Dialect.
Tag-based field access takes constant time. FIX Repeating Groups are lost without the complete FIX Dialect.
The message type and FIX protocol version cannot be changed.
FlatMessage FIX Repeating Groups are always preserved and can be accessed without the corresponding FIX Dialect. Tag-based field access requires the finding of the tag offset that takes linear time.
Keeps the field order. Does not support validation.
Any field can be changed.