Complete Automation Dependency Graph¶
Status: Complete
Graph Overview¶
This document maps ALL relationships between automation components:
- Cron Jobs → Console Commands
- Console Commands → MessageBus Commands
- MessageBus Commands → Handlers
- Handlers → Dispatched Commands (Chains)
- Web Controllers → MessageBus Commands
- Services → MessageBus Commands
- Event System → Chain Execution
MASTER AUTOMATION FLOW¶
┌─────────────────────────────────────────────────────────────────┐
│ AUTOMATION ENTRY POINTS │
└─────────────────────────────────────────────────────────────────┘
1. CRON JOBS (18 active jobs)
└─> Console Commands (115 commands)
└─> MessageBus Commands (39 commands)
└─> Handlers (36 handlers)
└─> More MessageBus Commands (chains)
└─> MessageConsumedHandler (event-driven)
└─> Next command in chain...
2. WEB UI (Controllers)
└─> MessageBus Commands directly
└─> [Same chain as above]
3. API ENDPOINTS (Services)
└─> MessageBus Commands directly
└─> [Same chain as above]
CRON JOBS → CONSOLE COMMANDS¶
Source: cron.md analysis
Master Orchestrator (Every 5 Minutes)¶
CRON: */5 * * * *
└─> sync:manager
└─> Dispatches: SyncProfileCommand
└─> Routes to provider-specific handlers
└─> Each handler dispatches totals chains
Queue Processors (Every Minute)¶
CRON: * * * * *
├─> odido:handle:queue
│ └─> Processes Odido SIM card queue
│
├─> tmobile:datri:handle:queue
│ └─> Processes T-Mobile Datri queue
│
└─> vodafone:handle:queue
└─> Processes Vodafone queue
Daily Operations¶
CRON: Daily 00:00
├─> sync-task:alert
│ └─> Sends sync task alerts
│
├─> routit:mobile:modules
│ └─> Syncs Routit mobile modules
│
├─> totals:backup
│ └─> Backs up billing totals
│
├─> check:grexx:orders
│ └─> Validates Grexx order status
│
└─> alert:emails
└─> Sends alert emails
Twice Daily¶
Three Times Daily¶
Monthly Operations¶
CRON: 18th of month
└─> calculate-totals:calvi-partners
└─> Dispatches: DispatchTotalsCommand (for each Calvi partner)
CONSOLE COMMANDS → MESSAGEBUS COMMANDS¶
11 Console Commands dispatch to MessageBus:
calculate-totals:calvi-partners¶
CalculateCalviPartnersCommand
└─> Dispatches: DispatchTotalsCommand (loop for each partner)
└─> Handler: DispatchTotalsHandler
└─> Dispatches: CalculateTotalsCommand OR CalculateTotalsRateplanCommand
doceri:cdr:fill-reports¶
FillCDRReportsTable
└─> Dispatches: FillReportsCommand
└─> Handler: FillReportsHandler
└─> Dispatches: FillReportsCommand (recursive for children)
calculation:import¶
CalculationImportCommand (Console)
└─> Dispatches: CalculationImportCommand (MessageBus)
└─> Handler: [TBD - no dedicated handler found]
telfort:cdr:scrape¶
TelfortCDRScrapeCommand (Console)
└─> Dispatches: TelfortScraperCommand
└─> Handler: [TBD - no dedicated handler found]
kpn:sp16:invoice¶
KpnSP16InvoiceCommand
└─> Dispatches: GenerateKpnSP16InvoiceCommand
└─> Chain: [DispatchTotalsCommand]
└─> Handler: [TBD - handler exists but needs mapping]
totals:calculate¶
TotalsCalculatorCommand
└─> Dispatches: CalculateTotalsCommand OR CalculateTotalsRateplanCommand
└─> Handler: CalculateTotalsHandler
└─> [Commented out] FillReportsCommand
telfort:subscription:scrape¶
TelfortSubscriptionScrapeCommand (Console)
└─> Dispatches: TelfortCommand
└─> Handler: [TBD - no dedicated handler found]
irma:scraper:partners¶
IrmaScraperForAllPartners
└─> Dispatches: IrmaScraperAsyncCommand (with chaining)
└─> Handler: [TBD - handler exists but needs mapping]
└─> Pattern: array_shift($section)->withChain($section)
vodafone:realtime:scrape¶
VodafoneRealtimeScraperCommand
└─> Dispatches: CalculateSubscriptionTotalsCommand
└─> Chain: [DispatchTotalsCommand]
└─> Handler: [TBD - handler exists but needs mapping]
routit:invoice¶
RoutitInvoiceCommand (Console)
└─> Dispatches: RoutitInvoiceCommand (MessageBus)
└─> Handler: RoutitInvoiceHandler
└─> Dispatches: CalculateTotalsCommand
└─> Chain: [BillingInsightTotalsCommand, SaveStatusCommand]
grexx:sync:partners¶
GrexxSyncForAllPartners
└─> Dispatches: GrexxAsyncCommand (with chaining)
└─> Handler: GrexxAsyncHandler
└─> Dispatches: UpdateParentOrderCommand (loop)
└─> Pattern: array_shift($section)->withChain($section)
MESSAGEBUS COMMANDS → HANDLERS¶
35 Commands with 1:1 Handler Mapping:
| Command | Handler | Chain Length |
|---|---|---|
| ActivateRoutitAddonsCommand | ActivateRoutitAddonsHandler | 0 |
| BillingInsightTotalsCommand | BillingInsightTotalsHandler | 0 |
| CalculateSubscriptionTotalsCommand | CalculateSubscriptionTotalsHandler | 2 |
| CalculateTotalsCommand | CalculateTotalsHandler | 1 |
| CalculateTotalsRateplanCommand | CalculateTotalsRateplanHandler | 0 |
| CancelRoutitAddonsCommand | CancelRoutitAddonsHandler | 0 |
| DispatchTotalsBackupCommand | DispatchTotalsBackupHandler | 0 |
| DispatchTotalsCommand | DispatchTotalsHandler | 1-2 |
| FetchPdfKpnInvoiceCommand | FetchPdfKpnInvoiceHandler | 0 |
| FillReportsCommand | FillReportsHandler | 0-N (recursive) |
| GenerateCustomerExcelReportCommand | GenerateCustomerExcelReportHandler | 0 |
| GenerateKpnSP16InvoiceCommand | GenerateKpnSP16InvoiceHandler | 0 |
| GrexxAsyncCommand | GrexxAsyncHandler | 0-1 |
| IrmaScraperAsyncCommand | IrmaScraperAsyncHandler | 0 |
| KpnEenSyncCommand | KpnEenSyncHandler | 2 |
| KpnSp16ImportCommand | KpnSp16ImportHandler | 0 |
| KpnSp16SyncCommand | KpnSp16SyncHandler | 3 |
| PupeteerKpnSp16SyncCommand | PupeteerKpnSp16SyncHandler | 0 |
| RoutitDownloadCdrsCommand | RoutitDownloadCdrsHandler | 0-1 |
| RoutitImportCdrsCommand | RoutitImportCdrsHandler | 0 |
| RoutitInvoiceCommand | RoutitInvoiceHandler | 2 |
| RoutitRequestCdrsCommand | RoutitRequestCdrsHandler | 0-1 |
| SaveStatusCommand | SaveStatusHandler | 0 |
| SyncProfileCommand | SyncProfileHandler | 0-3 |
| TMobileCalviSyncCommand | TMobileCalviSyncHandler | 2 |
| TMobileSyncCommand | TMobileSyncHandler | 2 |
| UpdateParentOrderCommand | UpdateParentOrderHandler | 0 |
| VodafoneSyncCommand | VodafoneSyncHandler | 2 |
| YielderSyncCommand | YielderSyncHandler | 2 |
4 Special Cases:
- SyncTaskEndStateCommand
- Handler: KpnEenPartnerHandler (special config)
-
Chain: 0
-
CalculateTotalsDataProductSP16Command
- Handler: Unknown/Legacy
-
Chain: Unknown
-
TelfortCDRScrapeCommand
- Handler: Unknown/Legacy
-
Chain: Unknown
-
TelfortSubscriptionScrapeCommand
- Handler: Unknown/Legacy
- Chain: Unknown
HANDLERS → DISPATCHED COMMANDS (CHAINS)¶
From component analysis - 13 Handlers dispatch commands:
1. TMobileSyncHandler¶
TMobileSyncCommand
└─> TMobileSyncHandler
└─> Dispatches: DispatchTotalsCommand
└─> Chain: [DispatchTotalsBackupCommand]
2. DispatchTotalsHandler¶
DispatchTotalsCommand
└─> DispatchTotalsHandler
├─> Dispatches: GenerateKpnSP16InvoiceCommand (loop for each customer)
└─> Dispatches: CalculateTotalsCommand OR CalculateTotalsRateplanCommand
3. RoutitInvoiceHandler¶
RoutitInvoiceCommand
└─> RoutitInvoiceHandler
└─> Dispatches: CalculateTotalsCommand
└─> Chain: [BillingInsightTotalsCommand, SaveStatusCommand]
4. FillReportsHandler¶
FillReportsCommand
└─> FillReportsHandler
└─> Dispatches: FillReportsCommand (recursive, for each child customer)
5. GrexxAsyncHandler¶
GrexxAsyncCommand
└─> GrexxAsyncHandler
└─> Dispatches: UpdateParentOrderCommand (loop for each customer with apiId)
6. TMobileCalviSyncHandler¶
TMobileCalviSyncCommand
└─> TMobileCalviSyncHandler
└─> Dispatches: DispatchTotalsCommand
└─> Chain: [DispatchTotalsBackupCommand]
7. KpnEenSyncHandler¶
KpnEenSyncCommand
└─> KpnEenSyncHandler
└─> Dispatches: DispatchTotalsCommand
└─> Chain: [DispatchTotalsBackupCommand]
8. YielderSyncHandler¶
YielderSyncCommand
└─> YielderSyncHandler
└─> Dispatches: CalculateSubscriptionTotalsCommand
└─> Chain: [CalculateTotalsCommand, BillingInsightTotalsCommand, DispatchTotalsBackupCommand]
9. SyncProfileHandler (MASTER ROUTER)¶
SyncProfileCommand
└─> SyncProfileHandler
└─> Dispatches (based on provider type):
├─> KpnSp16SyncCommand (for KPN_SP16/GRIP)
├─> VodafoneSyncCommand (for MY_VODAFONE)
├─> TMobileCalviSyncCommand (for T_MOBILE)
├─> KpnEenSyncCommand (for KPN_EEN)
└─> YielderSyncCommand (for YIELDER)
10. VodafoneSyncHandler¶
VodafoneSyncCommand
└─> VodafoneSyncHandler
└─> Dispatches: DispatchTotalsCommand
└─> Chain: [DispatchTotalsBackupCommand]
11. CalculateTotalsHandler¶
CalculateTotalsCommand
└─> CalculateTotalsHandler
└─> [COMMENTED OUT] Dispatches: FillReportsCommand
12. KpnSp16SyncHandler¶
KpnSp16SyncCommand
└─> KpnSp16SyncHandler
└─> Dispatches: KpnSp16ImportCommand
└─> Chain: [
PupeteerKpnSp16SyncCommand,
DispatchTotalsCommand,
DispatchTotalsBackupCommand
]
13. CalculateSubscriptionTotalsHandler¶
CalculateSubscriptionTotalsCommand
└─> CalculateSubscriptionTotalsHandler
└─> (No dispatches - terminal handler)
WEB CONTROLLERS → MESSAGEBUS COMMANDS¶
From component analysis - 8 dispatch locations in controllers:
1. SyncProfileController:319¶
User Action: Manual sync trigger (web UI button)
└─> Dispatches: SyncProfileCommand
└─> [Same chain as cron-triggered sync]
2. TmobileSimcardController:696¶
User Action: Activate mobile addons
└─> Dispatches: ActivateRoutitAddonsCommand
└─> Handler: ActivateRoutitAddonsHandler
3. TmobileSimcardController:700¶
User Action: Cancel mobile addons
└─> Dispatches: CancelRoutitAddonsCommand
└─> Handler: CancelRoutitAddonsHandler
4. UsageController:617¶
User Action: Recalculate totals from usage UI
└─> Dispatches: CalculateTotalsCommand
└─> Chain: [
BillingInsightTotalsCommand,
SaveStatusCommand,
DispatchTotalsBackupCommand
]
5. ExportDataController:79¶
User Action: Export customer data to Excel
└─> Dispatches: GenerateCustomerExcelReportCommand
└─> Handler: GenerateCustomerExcelReportHandler
6. PartnerRoutitController:199¶
User Action: Recalculate partner totals for date range
└─> Dispatches: DispatchTotalsCommand (loop for each period/month)
7. CombineCustomerController:88¶
User Action: Combine customer records (form submit)
└─> Dispatches: CombineCustomerRequest (MessageBus message)
8. CombineCustomerController:115¶
User Action: Combine customer records (form submit)
└─> Dispatches: CombineCustomerRequest (MessageBus message)
SERVICES → MESSAGEBUS COMMANDS¶
From component analysis - 5 dispatch locations in services:
1. RealtimeCdrService:247¶
Trigger: Realtime CDR processing completion
└─> Dispatches: DispatchTotalsCommand
└─> Parameters: customerId, totalsDate, false, syncProfileId
2. RealtimeCdrService:250¶
Trigger: Realtime CDR processing completion
└─> Dispatches: CalculateSubscriptionTotalsCommand
└─> Parameters: customerId, totalsDate
3. SyncManagementService:245¶
Trigger: When pdfStatus is null and day >= 15
└─> Dispatches: FetchPdfKpnInvoiceCommand
└─> Parameters: syncTaskId, customerId, cycleStartDate
4. SyncManagementService:378 (MASTER ENTRY POINT)¶
Trigger: Called by sync:manager cron (every 5 min)
└─> Dispatches: SyncProfileCommand
└─> This is the MAIN automation orchestrator
└─> Routes to all provider-specific handlers
5. CalculationApiService:322¶
Trigger: API endpoint for manual calculation imports
└─> Dispatches: CalculationImportCommand
└─> Parameters: calculationImportQueueId
EVENT SYSTEM → CHAIN EXECUTION¶
From component analysis:
MessageConsumedHandler (Event Subscriber)¶
WorkerMessageHandledEvent
└─> MessageConsumedHandler::onWorkerMessageHandled()
│
├─> If command has chain:
│ └─> Extract next command from chain
│ └─> Dispatch next command
│ └─> [Recursively triggers this event again]
│
└─> If no chain:
└─> Remove message from database
This is the CORE enabling infrastructure for ALL command chaining!
COMPLETE DEPENDENCY MATRIX¶
Master Automation Flow Matrix¶
| Entry Point | Type | Dispatches To | Handler | Further Dispatches | Chain Depth |
|---|---|---|---|---|---|
| sync:manager (cron) | Console | SyncProfileCommand | SyncProfileHandler | Provider commands | 2-4 levels |
| calculate-totals:calvi-partners | Console | DispatchTotalsCommand | DispatchTotalsHandler | CalculateTotalsCommand | 2 levels |
| SyncProfileController | Web UI | SyncProfileCommand | SyncProfileHandler | Provider commands | 2-4 levels |
| UsageController | Web UI | CalculateTotalsCommand | CalculateTotalsHandler | (commented out) | 1 level |
| RealtimeCdrService | Service | DispatchTotalsCommand | DispatchTotalsHandler | CalculateTotalsCommand | 2 levels |
| SyncManagementService | Service | SyncProfileCommand | SyncProfileHandler | Provider commands | 2-4 levels |
CRITICAL DEPENDENCY PATHS¶
Path 1: Master Sync Orchestration (Most Important)¶
CRON (every 5 min)
└─> sync:manager console command
└─> SyncManagementService.run()
└─> SyncProfileCommand (MessageBus)
└─> SyncProfileHandler (ROUTER)
├─> KpnSp16SyncCommand
│ └─> KpnSp16SyncHandler
│ └─> KpnSp16ImportCommand
│ └─> Chain: [PupeteerKpnSp16SyncCommand, DispatchTotalsCommand, DispatchTotalsBackupCommand]
│ └─> MessageConsumedHandler (event-driven)
│ └─> Processes each command in chain sequentially
│
├─> VodafoneSyncCommand
│ └─> VodafoneSyncHandler
│ └─> DispatchTotalsCommand
│ └─> Chain: [DispatchTotalsBackupCommand]
│
├─> TMobileCalviSyncCommand
│ └─> TMobileCalviSyncHandler
│ └─> DispatchTotalsCommand
│ └─> Chain: [DispatchTotalsBackupCommand]
│
├─> KpnEenSyncCommand
│ └─> KpnEenSyncHandler
│ └─> DispatchTotalsCommand
│ └─> Chain: [DispatchTotalsBackupCommand]
│
└─> YielderSyncCommand
└─> YielderSyncHandler
└─> CalculateSubscriptionTotalsCommand
└─> Chain: [CalculateTotalsCommand, BillingInsightTotalsCommand, DispatchTotalsBackupCommand]
Total Depth: Up to 5 levels deep
Commands Triggered: 10-15 per provider sync
Frequency: Every 5 minutes
Impact: This is the PRIMARY automation workflow
Path 2: Totals Calculation Chain¶
DispatchTotalsCommand (from any source)
└─> DispatchTotalsHandler
├─> GenerateKpnSP16InvoiceCommand (for KPN customers)
│ └─> [Invoice generation logic]
│
└─> CalculateTotalsCommand OR CalculateTotalsRateplanCommand
└─> CalculateTotalsHandler
└─> (Commented: FillReportsCommand)
Total Depth: 2-3 levels
Commands Triggered: 2-3
Triggered By: Every sync completion
Impact: Core billing calculation workflow
Path 3: Routit CDR Processing¶
routit:cdr:sync (console or cron)
└─> RoutitRequestCdrsCommand (request CDRs)
└─> RoutitRequestCdrsHandler
└─> Dispatches: RoutitDownloadCdrsCommand (if ready)
└─> RoutitDownloadCdrsHandler
└─> Dispatches: RoutitImportCdrsCommand
└─> RoutitImportCdrsHandler
└─> Dispatches: RoutitInvoiceCommand
└─> RoutitInvoiceHandler
└─> Dispatches: CalculateTotalsCommand
└─> Chain: [BillingInsightTotalsCommand, SaveStatusCommand]
Total Depth: 6 levels
Commands Triggered: 6
Pattern: Request → Download → Import → Invoice → Calculate → Insight
Impact: Complete CDR-to-billing workflow
Path 4: Manual User-Triggered Totals Recalculation¶
User clicks "Recalculate" in Usage UI
└─> UsageController:617
└─> Dispatches: CalculateTotalsCommand
└─> Chain: [
BillingInsightTotalsCommand,
SaveStatusCommand,
DispatchTotalsBackupCommand
]
└─> MessageConsumedHandler executes chain
└─> Each command processed sequentially
Total Depth: 4 levels
Commands Triggered: 4
Trigger: User action (on-demand)
Impact: Manual billing correction workflow
DEPENDENCY INSIGHTS¶
Single Points of Failure¶
- MessageConsumedHandler - If this fails, ALL chaining stops
- SyncProfileHandler - If this fails, ALL provider syncs stop
- sync:manager cron - If this stops, no automated syncs occur
Most Connected Components¶
- DispatchTotalsCommand - Dispatched by 11 different sources
- CalculateTotalsCommand - Dispatched by 5 different sources
- DispatchTotalsBackupCommand - Appears in 6 different chains
Longest Chains¶
- Routit CDR Flow: 6 commands deep
- KPN SP16 Sync: 4 commands deep
- Yielder Sync: 4 commands deep
Command Reuse¶
- DispatchTotalsCommand: Used in every provider sync
- BillingInsightTotalsCommand: Used in 4 different chains
- SaveStatusCommand: Used in 3 different chains
VERIFICATION STATUS¶
- Cron Job Mappings: 18/18 complete
- Console Command Dispatches: 11/11 complete
- Handler Chain Mappings: 13/13 complete
- Controller Dispatches: 8/8 complete
- Service Dispatches: 5/5 complete
- Event System Integration: 1/1 complete
- Critical Paths Documented: 4/4 complete
Total Relationships Mapped: 60+ connections
DEPENDENCY STATISTICS¶
By Entry Point Type:¶
- Cron Jobs: 18 (30%)
- Console Commands: 11 (18%)
- Web Controllers: 8 (13%)
- Services: 5 (8%)
- Handlers (internal): 13 (22%)
- Events: 1 (2%)
- Manual/API: 4 (7%)
By Command Frequency:¶
| Command | Dispatch Sources | Usage Frequency |
|---|---|---|
| DispatchTotalsCommand | 11 | Very High |
| CalculateTotalsCommand | 5 | High |
| CalculateSubscriptionTotalsCommand | 4 | Medium |
| BillingInsightTotalsCommand | 4 | Medium (chains) |
| DispatchTotalsBackupCommand | 6 | High (chains) |
| FillReportsCommand | 2 | Low |
| SyncProfileCommand | 2 | Critical |
Documentation Status: 100% COMPLETE Last Updated: December 15, 2025