How connamara/quickfixn works
Main Components and Their Roles
• Core FIX Engine (QuickFIXn)
• This is the heart of the system. It includes session management (Session, SessionFactory, SessionSettings, SessionID, SessionState), message parsing/encoding (Parser.cs, Message/MessageBuilder.cs, MessageCracker.cs), and transport/communication layers (SocketInitiator, ThreadedSocketAcceptor, SslStreamFactory, etc.).
• Helper modules such as Logger (FileLog, ScreenLog, etc.) and Store (FileStore, MemoryStore) that ensure persistence and logging support.
• Data Dictionary features are found in QuickFIXn/DataDictionary and related classes which help in parsing FIX specifications, validating messages, and mapping tags.
• Code Generation Tool (DDTool)
• This C#-based tool analyzes the FIX DataDictionary XML files and regenerates source code for field and message classes.
• How DDTool feeds into the “Messages” folder content (pre-generated FIX message classes for FIX40, FIX41, etc.).
• Message Definitions (Messages Directory)
• These directories (e.g., Messages/FIX40, FIX41, … up to FIX50, FIX50SP1, etc.) contain the auto-generated message code definitions for different FIX specification versions.
• They serve as the “vocabulary” used by the QuickFIX/n engine for encoding/decoding and handling communication.
• Testing Suites
• Acceptance Tests (AcceptanceTest directory) and UnitTests provide automated testing coverage.
• The AcceptanceTest folder includes various configuration files, acceptance test case source files, and scenario definitions (using NUnit and custom test runners).
• UnitTests show the modular test coverage of components such as parsers, message creation, session management, logging, and so forth.
• Examples and Scripts
• Examples folder demonstrates various usage scenarios (e.g., SimpleAcceptor, TradeClient, FixToJson conversion).
• Scripts (PowerShell) provide build, code-generation, deployment packaging, and version bumping capabilities.
Relationships and Interactions
• Data Flow Across Layers
• A client (initiator or acceptor) connects through the transport layer (networking components like SocketInitiator / ThreadedSocketAcceptor) to the core session layer.
• The Session component interacts with the Message Parser (which decodes raw FIX messages using DataDictionary definitions) and then routes messages via the Message Cracker to application callbacks implementing IApplication or IApplicationExt.
• The messages and fields then flow to higher-level business processing or logging modules.
• Code Generation Cycle
• DDTool takes DataDictionary XML files as input (see spec/fix directory) and generates standardized message classes in the Messages folder.
• This illustrates a design-time dependency that ensures the FIX engine is up-to-date with the protocol definitions.
• Testing and Validation
• The acceptance and unit tests validate that every module—from field processing and session state to logon and logout behavior—is working as expected.
• Tests are executed using the dotnet CLI (or within the IDE).
Architectural Patterns and Design Principles
• Layered Architecture
• Separate layers include: Transport → Message Encoding/Decoding → Session Management → Application Logic.
• Each layer communicates via clearly defined interfaces (e.g., IApplication, IMessageFactory, IField) which help in unit testing and decoupling.
• Factory and Builder Patterns
• Factories are used for message creation (DefaultMessageFactory, MessageFactory in Messages/* directories).
• The Builder pattern appears in MessageBuilder and message creation utilities.
• Pluggable Components
• Logging, message storage, and transport mechanisms are abstracted (ILog, IMessageStore, IFieldMapSpec) making them replaceable by custom implementations if required.