# yanlynn/sftpout_listener architecture

> Architecture diagram of the GitHub repository yanlynn/sftpout_listener, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yanlynn/sftpout_listener
- Repository: https://github.com/yanlynn/sftpout_listener

## Overview

SFTPOut_Listener is a Windows service that periodically claims ready batch records, builds filenames from database rows, and sends corresponding PGP and SGL files to configured banks. Its main workflow is visible in the service loop: read and claim batches, validate configuration and files, transfer both files in order, update status, and archive sent files. The graph includes configuration, database access, process execution, and logging as supporting layers. Source excerpts show the workflow and command-line execution; the remote bank connection is described but not implemented directly in the shown code.

Main entry points: [`SFTPOut_Listener/SFTPOutListener.cs`](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/SFTPOutListener.cs) (Batch Listener), [`SFTPOut_Listener/Transfer/TransferClients.cs`](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Transfer/TransferClients.cs) (Transfer Client), [`SFTPOut_Listener/Data/BatchDao.cs`](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Data/BatchDao.cs) (Batch DAO), [`SFTPOut_Listener/Program.cs`](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Program.cs) (Service Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Service Runtime"]
  node_entry["Service Entry<br/>[Program.cs]"]
  node_listener["Batch Listener<br/>[SFTPOutListener.cs]"]
end

subgraph group_workflow["Batch Workflow"]
  node_batch["Batch Record<br/>[BatchInfo.cs]"]
  node_factory["Transfer Client<br/>[TransferClients.cs]"]
end

subgraph group_integrations["External Integrations"]
  node_dao["Batch DAO<br/>[BatchDao.cs]"]
  node_files["Local Batch Files"]
end

subgraph group_support["Support Layers"]
  node_config["Runtime Settings<br/>[ConfigData.cs]"]
  node_bankconfig["Bank Settings<br/>[BankSettings.cs]"]
  node_runner["Process Runner<br/>[ProcessRunner.cs]"]
  node_logger["Logger<br/>[Logger.cs]"]
end

node_windows(("Windows Service Host"))
node_bank(("Bank Transfer Endpoint"))
node_database[("Batch Database")]

node_windows -->|"starts service"| node_entry
node_entry -->|"creates and runs"| node_listener
node_listener -->|"loads settings"| node_config
node_listener -->|"loads bank settings"| node_bankconfig
node_listener -->|"queries and updates"| node_dao
node_dao -->|"reads and writes batches"| node_database
node_dao -->|"creates records"| node_batch
node_listener -->|"validates and names"| node_batch
node_listener -->|"checks copies archives"| node_files
node_listener -->|"creates transfer client"| node_factory
node_factory -->|"runs transfer command"| node_runner
node_factory -.->|"transfers files"| node_bank
node_listener -->|"logs workflow"| node_logger
node_factory -->|"logs transfer results"| node_logger

click node_entry "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Program.cs"
click node_listener "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/SFTPOutListener.cs"
click node_config "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Config/ConfigData.cs"
click node_bankconfig "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Config/BankSettings.cs"
click node_dao "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Data/BatchDao.cs"
click node_batch "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Data/BatchInfo.cs"
click node_factory "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Transfer/TransferClients.cs"
click node_runner "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Util/ProcessRunner.cs"
click node_logger "https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Util/Logger.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_listener toneBlue
class node_batch,node_factory,node_database toneAmber
class node_dao,node_files toneMint
class node_config,node_bankconfig,node_runner,node_logger toneRose
class node_windows,node_bank toneIndigo
```

## Components

### Service Runtime

- [Service Entry](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Program.cs): `SFTPOut_Listener/Program.cs`
- [Batch Listener](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/SFTPOutListener.cs): `SFTPOut_Listener/SFTPOutListener.cs`

### Batch Workflow

- [Batch Record](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Data/BatchInfo.cs): `SFTPOut_Listener/Data/BatchInfo.cs`
- [Transfer Client](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Transfer/TransferClients.cs): `SFTPOut_Listener/Transfer/TransferClients.cs`

### External Integrations

- [Batch DAO](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Data/BatchDao.cs): `SFTPOut_Listener/Data/BatchDao.cs`
- **Local Batch Files**

### Support Layers

- [Runtime Settings](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Config/ConfigData.cs): `SFTPOut_Listener/Config/ConfigData.cs`
- [Bank Settings](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Config/BankSettings.cs): `SFTPOut_Listener/Config/BankSettings.cs`
- [Process Runner](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Util/ProcessRunner.cs): `SFTPOut_Listener/Util/ProcessRunner.cs`
- [Logger](https://github.com/yanlynn/sftpout_listener/blob/main/SFTPOut_Listener/Util/Logger.cs): `SFTPOut_Listener/Util/Logger.cs`

### Other components

- **Windows Service Host**
- **Bank Transfer Endpoint**
- **Batch Database**

## Connections

- Windows Service Host → Service Entry: starts service (evidence: `SFTPOut_Listener/Program.cs`)
- Service Entry → Batch Listener: creates and runs (evidence: `SFTPOut_Listener/Program.cs`)
- Batch Listener → Runtime Settings: loads settings (evidence: `SFTPOut_Listener/SFTPOutListener.cs`)
- Batch Listener → Bank Settings: loads bank settings (evidence: `SFTPOut_Listener/SFTPOutListener.cs`)
- Batch Listener → Batch DAO: queries and updates (evidence: `SFTPOut_Listener/SFTPOutListener.cs`)
- Batch DAO → Batch Database: reads and writes batches (evidence: `SFTPOut_Listener/Data/BatchDao.cs`)
- Batch DAO → Batch Record: creates records (evidence: `SFTPOut_Listener/Data/BatchDao.cs`)
- Batch Listener → Batch Record: validates and names (evidence: `SFTPOut_Listener/SFTPOutListener.cs`)
- Batch Listener → Local Batch Files: checks copies archives (evidence: `SFTPOut_Listener/SFTPOutListener.cs`)
- Batch Listener → Transfer Client: creates transfer client (evidence: `SFTPOut_Listener/SFTPOutListener.cs`)
- Transfer Client → Process Runner: runs transfer command (evidence: `SFTPOut_Listener/Transfer/TransferClients.cs`)
- Transfer Client → Bank Transfer Endpoint: transfers files
- Batch Listener → Logger: logs workflow (evidence: `SFTPOut_Listener/SFTPOutListener.cs`)
- Transfer Client → Logger: logs transfer results (evidence: `SFTPOut_Listener/Transfer/TransferClients.cs`)
