Background process models
Background process models manage asynchronous job execution, scheduled tasks, and long-running operations in Chargeworx.BackgroundProcess
Tracks background jobs and scheduled tasks executed by the system.Key properties
| Property | Type | Description |
|---|---|---|
| Id | Guid | Unique process identifier |
| ProcessType | String | Type of background process |
| Status | String | Current process status |
| Priority | Int | Execution priority |
| ScheduledAt | DateTime | Scheduled execution time |
| StartedAt | DateTime? | Actual start time |
| CompletedAt | DateTime? | Completion time |
| RetryCount | Int | Number of retry attempts |
| MaxRetries | Int | Maximum retry attempts allowed |
| ErrorMessage | String | Error details if failed |
| ProcessData | String | Job-specific data (JSON) |
Process types
| Type | Description |
|---|---|
| TransactionProcessing | Process pending transactions |
| BatchSettlement | Submit settlement batches |
| AccountUpdater | Check for card updates |
| ReportGeneration | Generate scheduled reports |
| DataExport | Export transaction data |
| EmailNotification | Send email notifications |
| RecurringBilling | Process recurring charges |
Status values
| Status | Description |
|---|---|
| Pending | Queued for execution |
| Running | Currently executing |
| Completed | Successfully completed |
| Failed | Execution failed |
| Cancelled | Manually cancelled |
| Retrying | Retry in progress |
Usage patterns
Job scheduling
Background processes can be scheduled for immediate or future execution. Jobs are prioritized and executed by worker processes.Retry logic
Failed jobs are automatically retried based on the configured retry policy. Each retry attempt is logged with error details.Job monitoring
Process status can be monitored through the admin UI or API. Long-running jobs provide progress updates.Job cancellation
Running or pending jobs can be cancelled manually if needed. Cancellation is graceful and allows cleanup operations.Common background processes
Transaction processing
Asynchronous transaction processing for high-volume scenarios. Transactions are queued and processed in batches.Batch settlement
Automated submission of transaction batches to payment processors on configured schedules.Account updater
Scheduled checks for credit card updates from card issuers.Report generation
Scheduled generation of transaction reports, reconciliation files, and analytics.Recurring billing
Automated processing of recurring charges based on billing schedules.Best practices
- Set appropriate retry limits for different job types
- Monitor failed jobs and investigate root causes
- Use priority levels to ensure critical jobs execute first
- Implement idempotent job handlers to safely retry operations
- Log detailed error information for troubleshooting
- Clean up completed job records periodically
Performance considerations
- Jobs are executed by worker processes separate from web requests
- High-priority jobs are processed before lower-priority jobs
- Long-running jobs should provide progress updates
- Failed jobs are retried with exponential backoff
- Job queues are monitored for capacity and performance
