Configuration
How to configure Swig for your needs
Configuration
Queue Configuration
Swig allows you to configure multiple queues with different worker pools:
Each queue operates independently with its own worker pool, allowing you to:
- Process priority jobs faster with dedicated workers
- Prevent low-priority jobs from blocking important tasks
- Scale worker pools based on queue requirements
Worker Configuration
Workers must implement the Worker
interface:
Example worker implementation:
Worker Registration
Workers must be registered with Swig before they can process jobs:
Job Options
When adding jobs, you can specify various options:
Batch Processing
Swig supports efficient batch job insertion:
Transactional Batch Processing
Batch jobs can also be inserted within a transaction:
Transaction Support
Swig integrates seamlessly with your existing transactions:
Error Handling
Swig provides comprehensive error handling:
- Failed jobs are automatically retried with exponential backoff
- Maximum retry attempts can be configured
- Error details are stored in the database for debugging
Cleanup and Testing
Swig provides methods for both graceful shutdown and complete cleanup:
The Close
method is particularly useful in:
- Testing environments to clean up after tests
- Development scenarios to reset state
- CI/CD pipelines needing clean slate between runs
Example usage in tests:
Next Steps
- Examples - See Swig in action with practical examples
- API Reference - Detailed API documentation