Expense Batch Dispatcher
Component Detail
Service Layer
high complexity
backend
2
Dependencies
1
Dependents
2
Entities
0
Integrations
Description
Asynchronous background service that queues approved expense claims and dispatches them to the Accounting API Connector in batches. Implements retry logic with exponential backoff for transient failures and tracks dispatch state per organization to prevent duplicate submissions.
expense-batch-dispatcher
Responsibilities
- Enqueue approved expense claims for asynchronous dispatch to the accounting system
- Execute batch dispatch jobs in the background without blocking the main request cycle
- Apply exponential backoff retry logic for transient connectivity or API failures
- Track per-organization dispatch state to prevent duplicate batch submissions
- Write job outcome events to accounting_integration_logs
Interfaces
enqueueBatch(orgId: string, expenseIds: string[]): Promise<JobId>
processQueue(orgId: string): Promise<DispatchSummary>
retryFailedBatch(jobId: string): Promise<DispatchResult>
getQueueStatus(orgId: string): QueueStatus
Relationships
Dependencies (2)
Components this component depends on
Related Data Entities (2)
Data entities managed by this component