Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Amqp Interop

Amqp Interop Laravel Package

queue-interop/amqp-interop

AMQP interop interfaces for PHP message queues. Defines common contracts to work with AMQP brokers (e.g., RabbitMQ) across different clients and frameworks, enabling portable producers/consumers, exchanges, queues, and message handling without vendor lock-in.

View on GitHub
Deep Wiki
Context7

AMQP interop

Frequently asked questions about Amqp Interop
How do I use amqp-interop with Laravel’s existing queue system?
The package doesn’t replace Laravel’s queue drivers but extends them via queue-interop. Register an AMQP connection in your `config/queue.php` under `connections`, then dispatch jobs using Laravel’s `Queue` facade. For example, set `driver: amqp` and configure the broker (e.g., RabbitMQ) in the connection array. Existing `dispatch()` calls remain unchanged.
Which Laravel versions support amqp-interop?
The package works with Laravel 5.5+ (PHP 7.1+) due to its queue-interop foundation. For newer Laravel versions (6.x, 7.x, 8.x, 9.x, 10.x), ensure your AMQP library (e.g., `videlalvaro/php-amqplib`) is compatible. Test thoroughly, as some Laravel queue features (e.g., job middleware) may need manual AMQP-specific adjustments.
Can I mix AMQP with other Laravel queue drivers (e.g., Redis, database)?
Yes, Laravel supports multiple queue connections. Configure AMQP as one connection and Redis/database as others in `config/queue.php`. Dispatch jobs to specific connections using `Queue::connection('amqp')->push()`. This is useful for separating critical AMQP workloads from lighter Redis queues.
How do I handle message acknowledgments in Laravel workers with AMQP?
Laravel’s default `queue:work` command may not handle AMQP acknowledgments automatically. Extend Laravel’s `Worker` class or use a custom worker to manually acknowledge messages via the AMQP client (e.g., `channel->ack()`). For retries, implement a dead-letter queue (DLQ) in your AMQP broker and configure Laravel’s `failed_jobs` table to log AMQP-specific failures.
What’s the best way to serialize Laravel jobs for AMQP?
AMQP typically expects binary or JSON payloads. Laravel’s default job serialization (PHP closures/models) may not work out-of-the-box. Convert jobs to JSON using `json_encode()` before dispatching or use a message adapter (e.g., `queue-interop`’s `Message` interface) to wrap Laravel jobs. Ensure your worker deserializes the payload correctly.
How do I monitor AMQP queues in Laravel?
Laravel’s built-in monitoring (e.g., `failed_jobs` table) won’t cover AMQP metrics. Integrate your AMQP broker’s management API (e.g., RabbitMQ’s HTTP API) with Laravel using a package like `spatie/laravel-monitoring` or custom scripts. Track metrics like message rate, consumer lag, and broker health separately.
Is amqp-interop suitable for production workloads with high throughput?
AMQP can handle high throughput but introduces latency compared to Redis or database queues. Benchmark your setup with tools like `k6` or `wrk`. Optimize by tuning prefetch counts, batching messages, or using connection pooling. Monitor broker resources (e.g., RabbitMQ memory usage) to avoid bottlenecks.
What alternatives exist for AMQP in Laravel?
For simpler setups, consider Laravel’s native `redis` or `database` drivers. For more advanced messaging, explore `laravel-queue` packages like `predis/predis` (Redis) or `iron-io/iron_mq` (IronMQ). If you need protocol-agnostic queues, `queue-interop` supports other brokers like Kafka via libraries like `rdkafka/rdkafka`.
How do I configure a RabbitMQ cluster with amqp-interop in Laravel?
Configure your AMQP connection in `config/queue.php` with a load-balanced list of RabbitMQ nodes (e.g., `hosts: ['rabbit1.example.com', 'rabbit2.example.com']`). Use the `videlalvaro/php-amqplib` library’s clustering features or a connection pooler like `enqueue/amqp-ext`. Ensure Laravel’s retry logic accounts for node failures by implementing exponential backoff.
Can I use amqp-interop with Laravel’s Horizon for queue monitoring?
Horizon primarily supports Redis and database queues. For AMQP, you’ll need a custom solution. Use Horizon’s event system to log AMQP-specific metrics (e.g., message counts) or integrate a third-party monitoring tool like Prometheus with your AMQP broker. Alternatively, build a custom dashboard using Laravel’s `queue:failed` command and AMQP broker stats.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai