# esanchezros/quickfixj-spring-boot-starter architecture

> Architecture diagram of the GitHub repository esanchezros/quickfixj-spring-boot-starter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/esanchezros/quickfixj-spring-boot-starter
- Repository: https://github.com/esanchezros/quickfixj-spring-boot-starter

## Overview

##### Main Components
- Modules: Based on the file tree, you have several key modules:
- quickfixj-spring-boot-starter (the primary entry point for users)
- quickfixj-spring-boot-actuator (provides actuator endpoints for health and monitoring)
- quickfixj-spring-boot-autoconfigure (contains the auto-configuration logic for QuickFIX/J)
- quickfixj-spring-boot-context (manages the common Spring context, bean definitions, and exception models)
- QuickFIX/J Connectors:
- Server (Acceptor): Provides components like MessageStoreFactory, LogFactory, and the Acceptor itself.
- Client (Initiator): Similarly sets up its specific MessageStoreFactory, LogFactory, and Initiator.
- Supporting Components:
- QuickFixJTemplate: A synchronous template to send messages.
- EventPublisherApplicationAdapter: A default Application implementation that publishes messages as Spring ApplicationEvents.
- Health Indicators and Actuator Endpoints for server and client diagnostics.
- Configuration Elements:
- External configuration via properties/yaml or configuration files (see quickfixj.server.configString, quickfixj.client.configString, etc.)
- Beans that provide the underlying QuickFIX/J components.

##### Relationships and Interactions
- The Spring Boot Application serves as the container for the entire configuration.
- The autoconfiguration module detects and creates default beans for QuickFIX/J components (either server/acceptor or client/initiator) based on provided properties.
- The context module holds shared beans and common exception handling.
- The actuator module integrates with Spring Boot’s management endpoints so that QuickFIX/J’s status and health are exposed (for example, the endpoints: /actuator/quickfixjserver and /actuator/quickfixjclient).
- The QuickFixJTemplate is “wired” via dependency injection into any clients that need to send messages.
- Optional separate Spring contexts can be used when the application requires multiple QuickFIX/J instances (as shown in the README sample for combining clients and servers in a parent/child context).

##### Architectural Patterns and Design Principles
- Auto-configuration and “starter” mechanism: Uses Spring Boot auto-configuration to provide defaults that can be overridden.
- Modular architecture: The project is divided into modules that separate concerns (e.g., configuration, actuator endpoints, core context, etc.).
- Template pattern: The QuickFixJTemplate abstracts common operations to simplify sending messages.
- Event-driven design: The default Application implementation publishes FIX messages as events for other components to consume.
- Spring’s dependency injection is used throughout to simplify customization and extension.

##### Relevant Technologies and Frameworks
- Spring Boot (including Spring’s dependency injection and actuator subsystem)
- QuickFIX/J (for the FIX protocol messaging functionality)
- Maven (as the build and dependency management tool)
- Optional components such as JMX (for monitoring) are also integrated via actuator endpoints

## Diagram (Mermaid)

```mermaid
graph TD
    %% External Configuration
    Config["External Configuration<br/>(properties, YAML, etc.)"]:::config

    %% Spring Boot Application Context Container
    subgraph "Spring Boot Application Context"
        %% Modules
        Starter["quickfixj-spring-boot-starter"]:::module
        AutoCfg["quickfixj-spring-boot-autoconfigure"]:::module
        Context["quickfixj-spring-boot-context"]:::module
        Actuator["quickfixj-spring-boot-actuator"]:::module

        %% Auto-configuration details for QuickFIX/J Connectors
        ServerAC["QuickFIX/J Server<br/>(Acceptor) Beans<br/>(MessageStoreFactory, LogFactory, Acceptor)"]:::connector
        ClientAC["QuickFIX/J Client<br/>(Initiator) Beans<br/>(MessageStoreFactory, LogFactory, Initiator)"]:::connector

        %% Context-specific components
        Template["QuickFixJTemplate<br/>(Synchronous Message Sender)"]:::template
        EventPublisher["EventPublisherApplicationAdapter<br/>(Publishes ApplicationEvents)"]:::template

        %% Service Layer representing message usage
        Service["Service Layer<br/>(Uses Messaging API)"]:::service

        %% Actuator endpoints and health
        Endpoints["Actuator Endpoints<br/>(/actuator/quickfixjserver,<br/>/actuator/quickfixjclient)"]:::actuator
        Health["Health Indicators<br/>(QuickFIX/J Session Health)"]:::actuator
    end

    %% Relationships
    Config -->|"feeds"| AutoCfg
    AutoCfg -->|"creates"| ServerAC
    AutoCfg -->|"creates"| ClientAC
    ServerAC -->|"exposes health"| Endpoints
    ClientAC -->|"exposes health"| Endpoints
    Endpoints -->|"monitored by"| Health

    Context -->|"provides"| Template
    Context -->|"provides"| EventPublisher
    Template -->|"invoked by"| Service
    EventPublisher -->|"publishes events to"| Service

    %% Styling Classes
    classDef module fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef connector fill:#F9D371,stroke:#333,stroke-width:2px;
    classDef template fill:#C1E1C1,stroke:#333,stroke-width:2px;
    classDef actuator fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef service fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef config fill:#FFE4B5,stroke:#333,stroke-width:2px;

    %% Click Events for Component Mapping
    click Starter "https://github.com/esanchezros/quickfixj-spring-boot-starter/blob/main/quickfixj-spring-boot-starter/pom.xml"
    click Actuator "https://github.com/esanchezros/quickfixj-spring-boot-starter/tree/main/quickfixj-spring-boot-actuator/src/main/java/io/allune/quickfixj/spring/boot/actuate"
    click AutoCfg "https://github.com/esanchezros/quickfixj-spring-boot-starter/tree/main/quickfixj-spring-boot-autoconfigure/src/main/java/io/allune/quickfixj/spring/boot/starter/autoconfigure"
    click Context "https://github.com/esanchezros/quickfixj-spring-boot-starter/tree/main/quickfixj-spring-boot-context/src/main/java/io/allune/quickfixj/spring/boot/starter"
    click EventPublisher "https://github.com/esanchezros/quickfixj-spring-boot-starter/blob/main/quickfixj-spring-boot-context/src/main/java/io/allune/quickfixj/spring/boot/starter/application/EventPublisherApplicationAdapter.java"
    click Template "https://github.com/esanchezros/quickfixj-spring-boot-starter/blob/main/quickfixj-spring-boot-context/src/main/java/io/allune/quickfixj/spring/boot/starter/template/QuickFixJTemplate.java"
    click ServerAC "https://github.com/esanchezros/quickfixj-spring-boot-starter/blob/main/quickfixj-spring-boot-autoconfigure/src/main/java/io/allune/quickfixj/spring/boot/starter/autoconfigure/server/QuickFixJServerAutoConfiguration.java"
    click ClientAC "https://github.com/esanchezros/quickfixj-spring-boot-starter/blob/main/quickfixj-spring-boot-autoconfigure/src/main/java/io/allune/quickfixj/spring/boot/starter/autoconfigure/client/QuickFixJClientAutoConfiguration.java"
    click Health "https://github.com/esanchezros/quickfixj-spring-boot-starter/blob/main/quickfixj-spring-boot-actuator/src/main/java/io/allune/quickfixj/spring/boot/actuate/health/QuickFixJSessionHealthIndicator.java"
```
