- How do I integrate **enqueue/amqp-bunny** with Laravel’s queue system?
- Use the **enqueue/laravel** package to bridge Enqueue with Laravel. Configure your `config/queue.php` to include the AMQP connection, then dispatch jobs with `Queue::connection('amqp')->push()`. For custom consumers, extend Laravel’s queue workers or use Enqueue’s consumer tools.
- What Laravel versions does **enqueue/amqp-bunny** support?
- The package requires **PHP 8.1+** and works with Laravel 8.x, 9.x, and 10.x. Older Laravel versions (<8.0) may need dependency adjustments due to PHP version constraints. Always check the [Enqueue compatibility docs](https://php-enqueue.github.io/) for specifics.
- Can I use **amqp-bunny** for event-driven architectures in Laravel?
- Yes. AMQP’s pub/sub model via exchanges and routing keys makes it perfect for event-driven workflows. Publish events to RabbitMQ and consume them in Laravel using Enqueue’s consumers or Laravel’s queue listeners with the AMQP connection.
- How does **enqueue/amqp-bunny** handle connection reliability in production?
- The underlying **Bunny** library manages reconnections, heartbeats, and failover automatically. For critical systems, configure retry policies in Enqueue’s middleware and use dead-letter exchanges to handle poison messages. Monitor RabbitMQ cluster health separately.
- What’s the performance difference between AMQP (RabbitMQ) and Laravel’s Redis queue?
- AMQP introduces higher latency (~10–50ms) than Redis due to network overhead, but excels in distributed scenarios with advanced features like QoS, persistence, and routing. Benchmark your workload—Redis is simpler for single-server setups, while AMQP scales better for microservices.
- Do I need to manage RabbitMQ infrastructure myself, or are there managed options?
- You can self-host RabbitMQ or use managed services like **CloudAMQP**, **RabbitMQ Cloud**, or **AWS MQ**. Managed options reduce operational burden but may incur costs. Ensure your provider supports AMQP 0-9-1 for full compatibility with **amqp-bunny**.
- How do I handle job retries and dead-letter queues with **enqueue/amqp-bunny**?
- Use Enqueue’s **retry middleware** and configure dead-letter exchanges in RabbitMQ. For Laravel, extend the queue listener with custom logic to republish failed jobs or log them. Example: Set `x-dead-letter-exchange` in queue declarations and handle failures via Enqueue’s error listeners.
- Is **enqueue/amqp-bunny** compatible with Laravel’s Horizon or other queue monitoring tools?
- No direct integration exists, but you can monitor RabbitMQ queues via **RabbitMQ Management UI** or tools like **Prometheus/Grafana**. For Laravel-specific monitoring, use Enqueue’s **statsd** or **prometheus** extensions alongside Horizon for hybrid setups.
- What alternatives exist for AMQP in Laravel if **enqueue/amqp-bunny** isn’t suitable?
- Consider **php-amqplib** (direct RabbitMQ client) or **Enqueue’s other transports** like **Redis** or **Database**. For simpler needs, Laravel’s built-in **Redis/SQS** drivers may suffice. If you need AMQP interop, **enqueue/amqp-lib** (using `php-amqplib`) is another option.
- How do I test **enqueue/amqp-bunny** in a Laravel CI pipeline?
- Use a **test RabbitMQ container** (e.g., Docker) with `php-enqueue/amqp-bunny` configured for a temporary URL. Mock the AMQP client in unit tests with **Enqueue’s test utilities** or **PHPUnit**. For integration tests, spin up a real broker or use a local instance with unique credentials.