- How do I install enqueue/dbal in a Laravel project?
- Run `composer require enqueue/dbal` and `composer require php-enqueue/laravel` for Laravel integration. Configure the transport in your Enqueue context (e.g., `DbalTransport` with your Doctrine DBAL connection). Ensure Doctrine DBAL is installed (v2.5+) and your database schema is set up.
- Does enqueue/dbal work with Laravel’s built-in queue system?
- No, it requires Enqueue for advanced features like retries, dead-letter queues, and priority queues. Use it alongside Laravel’s queue system if you need Enqueue’s capabilities, but avoid mixing transports for the same queue to prevent conflicts.
- What Laravel versions does enqueue/dbal support?
- The package works with Laravel 8.x, 9.x, and 10.x via the `php-enqueue/laravel` bridge. Ensure your Laravel version aligns with Enqueue’s compatibility (check the [Enqueue docs](https://php-enqueue.github.io/transport/dbal/) for specifics).
- How do I set up the database schema for enqueue/dbal?
- Use Doctrine Migrations or raw SQL to create the required tables (`enqueue_message`, `enqueue_queue`, `enqueue_lock`). The package doesn’t auto-migrate, so include schema setup in your deployment process. Example migrations are in the [Enqueue DBAL docs](https://php-enqueue.github.io/transport/dbal/).
- Can I use enqueue/dbal for high-throughput messaging (e.g., 1000+ messages/sec)?
- No, DBAL is not optimized for high throughput. It’s best for low-to-moderate volume (e.g., background jobs, notifications). For high throughput, use Redis or RabbitMQ. Benchmark under your expected load—DBAL may struggle with >1000 msg/sec due to polling and transaction overhead.
- How does enqueue/dbal handle distributed locking for consumers?
- Locking is managed via database transactions and the `enqueue_lock` table. In distributed setups, contention can occur. Use optimistic locking or external locks (e.g., Redis) for critical paths. Avoid long-running locks to prevent deadlocks.
- What’s the difference between enqueue/dbal and Laravel’s database queue driver?
- enqueue/dbal is part of the Enqueue ecosystem, offering advanced features like retries, dead-letter queues, and priority queues. Laravel’s built-in database driver is simpler but lacks these features. Use enqueue/dbal if you need Enqueue’s functionality or already use Doctrine DBAL.
- How do I monitor message processing with enqueue/dbal?
- The package lacks native metrics, so instrument with custom logging (e.g., log message IDs, processing times). Integrate with Laravel’s queue monitoring or use a third-party tool like Prometheus. Track retries, failures, and lock durations manually.
- Can I switch from enqueue/dbal to Redis later without rewriting code?
- Yes, abstract your queue logic behind an interface (e.g., `QueueInterface`) and use dependency injection. This allows swapping transports (e.g., `DbalTransport` → `RedisTransport`) with minimal changes. Follow Enqueue’s [transport abstraction guide](https://php-enqueue.github.io/).
- What databases does enqueue/dbal support?
- Any database supported by Doctrine DBAL (v2.5+), including PostgreSQL, MySQL, SQLite, and others. Performance varies—PostgreSQL and MySQL are recommended for production. Test your specific database under expected load to validate latency and reliability.