# pixelbyaj/mqdotnetclient architecture

> Architecture diagram of the GitHub repository pixelbyaj/mqdotnetclient, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pixelbyaj/mqdotnetclient
- Repository: https://github.com/pixelbyaj/mqdotnetclient

## Overview

##### Main Components
- Client Application Core – Represented by the MQDotnetClientApp directory. This contains key source files such as Program.cs and ConfigHelper.cs that initialize the application, set up configuration (from appsettings.json), create a service provider with logging, build up the QueueManager instance, as well as initiate message put/get operations.
- Configuration Module – Highlight the use of appsettings.json and the ConfigHelper class to extract all necessary settings for both IBM MQ connectivity and retry policies.
- IBM MQ Connectivity Component – This is encapsulated in the QueueManager and related model classes (QueueManagerModel and QueueRetryPolicy). It takes care of connecting to the queue manager, handling connection parameters, secure options, and retry/circuit-breaker logic.
- External Libraries and Dependencies – Include the IBMMQDotnetClient library for communication with IBM MQ, Microsoft.Extensions.Logging for logging, and Polly for managing resilience aspects.
- Dockerized IBM MQ Instance – Represented by the docker-compose.yml file. This component shows an externally hosted MQ Broker environment that provides actual MQ objects (Queue Manager QM1, DEV.QUEUE.1, channel DEV.APP.SVRCONN, listener SYSTEM.LISTENER.TCP.1) used by the client library.

##### Relationships and Interactions
- That the IBM MQ Connectivity Component relies on the IBMMQDotnetClient library for sending and receiving messages.

##### Architectural Patterns and Design Principles
- Separation of Concerns – Clearly show that configuration, connectivity, message processing, and logging are separate modules/components.
- Resilience and Fault Tolerance – Highlight the retry policy component (including parameters such as RetryCount, WaitAndRetrySeconds, etc.) and circuit breaker functionality.
- Dependency Injection – Present the use of a service provider for decoupling the logging and configuration connectors from the business logic.

##### Relevant Technologies and Frameworks
- .NET (C#) base for the application
- IBM MQ .NET Client library (IBMMQDotnetClient)
- Microsoft.Extensions.Logging
- Polly (for transient-fault-handling)
- Docker and docker-compose (for the MQ instance container)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Internal Application Modules
    A("Client Application Core (MQDotnetClientApp)"):::internal
    subgraph "Configuration Module"
        B("appsettings.json"):::internal
        C("ConfigHelper.cs"):::internal
    end
    D("IBM MQ Connectivity (Program.cs)"):::internal

    %% External Libraries / Frameworks
    E("IBMMQDotnetClient Library"):::library
    F("Microsoft.Extensions.Logging"):::library
    G("Polly (FaultTolerance)"):::library

    %% External Dockerized IBM MQ Instance
    H("Dockerized IBM MQ Instance (docker-compose.yml)"):::external

    %% Connections
    A -->|"reads_config"| B
    A -->|"reads_config"| C
    A -->|"initiates_connection"| D
    D -->|"uses"| E
    A -->|"uses_logging"| F
    A -->|"handles_faults"| G
    D -->|"connects_to"| H

    %% Click Events
    click A "https://github.com/pixelbyaj/mqdotnetclient/tree/main/MQDotnetClientApp"
    click B "https://github.com/pixelbyaj/mqdotnetclient/blob/main/MQDotnetClientApp/appsettings.json"
    click C "https://github.com/pixelbyaj/mqdotnetclient/blob/main/MQDotnetClientApp/ConfigHelper.cs"
    click D "https://github.com/pixelbyaj/mqdotnetclient/blob/main/MQDotnetClientApp/Program.cs"
    click H "https://github.com/pixelbyaj/mqdotnetclient/blob/main/docker-compose.yml"

    %% Styles
    classDef internal fill:#AED6F1,stroke:#5DADE2,stroke-width:2px,color:#1A5276;
    classDef library fill:#F9E79F,stroke:#F1C40F,stroke-width:2px,color:#7D6608;
    classDef external fill:#A9DFBF,stroke:#28B463,stroke-width:2px,color:#145A32;
```
