- Can I use allprogrammic/resque-bundle in Symfony 5 or 6?
- No, this bundle officially supports Symfony 2.7–4.x only. Symfony 5/6+ would require polyfills for deprecated components like SwiftmailerBundle or a custom wrapper to abstract bundle-specific logic. Check for forks or consider alternatives like Symfony Messenger.
- How do I define recurring tasks in this bundle?
- Recurring tasks are defined in a YAML/array config file using cron syntax (e.g., `*/5 * * * *` for every 5 minutes). Specify the class, queue, arguments, and description in the config, then load it via the `resque:recurring` command with the path to your config file.
- Does this bundle support PHP 8.x?
- No, the package targets PHP 5.5–7.0. PHP 8.x compatibility is untested, and unmaintained dependencies (like `allprogrammic/redis-client`) may introduce runtime errors. Consider alternatives if PHP 8.x is required.
- What happens if Redis crashes or loses data?
- Redis persistence (RDB snapshots or AOF) must be configured separately to prevent data loss. Without persistence, all queued tasks could be lost. For high availability, use Redis Sentinel or Cluster, though the bundle may not fully support advanced Redis features.
- How do I monitor or alert on failed tasks?
- Failed tasks trigger alerts via SwiftmailerBundle by default. If you don’t use Swiftmailer, you’ll need to implement custom logging or monitoring (e.g., Prometheus metrics or a dead-letter queue). The bundle lacks built-in retry or priority queues for failed jobs.
- Is this bundle suitable for CPU-intensive tasks?
- Resque is not ideal for long-running or CPU-heavy tasks due to Redis timeouts (default: 30 seconds). For such workloads, consider alternatives like Symfony Messenger with a message broker (e.g., RabbitMQ) or offload processing to a separate service.
- How do I scale workers for high load?
- Scale workers by running multiple instances (e.g., via Supervisor or PM2) and distributing queues across them. Example: `numprocs=4` in Supervisor for a 4-core CPU. Redis itself may become a bottleneck; consider clustering or sharding for horizontal scaling.
- What alternatives exist for Symfony task scheduling?
- For Symfony 5/6+, consider Symfony Messenger with Doctrine Messenger or Enqueue for Redis/RabbitMQ. For legacy Symfony, alternatives include native cron with database locks or libraries like Spatie Scheduler. Evaluate based on Redis dependency and modern features like retries.
- How do I migrate from cron to this bundle?
- Audit existing cron jobs, then define them in a YAML config file using cron syntax. Replace cron entries with `resque:recurring` commands in your crontab. Start with non-critical tasks, test in a staging environment, and monitor Redis performance before full migration.
- Does this bundle support distributed locking to prevent overlapping tasks?
- No, the bundle lacks built-in distributed locking, which could lead to race conditions if multiple workers process the same task. For critical tasks, implement custom locking (e.g., Redis SETNX) or use an alternative with native support like Symfony Messenger.