- Can I use aescarcha/async in Laravel, or is it only for Symfony?
- While originally designed for Symfony, you can adapt it for Laravel by replacing Symfony’s Doctrine listeners with Laravel’s Model Observers or EventServiceProvider, and using a RabbitMQ bridge like vladimir-yuldashev/laravel-queue-rabbitmq to handle queue consumption. The core async logic remains the same.
- What Laravel versions does aescarcha/async support?
- The package itself is Symfony-focused, but Laravel 5.5+ can integrate it via custom event listeners and RabbitMQ bridges. Test compatibility with your Laravel version by validating Doctrine event hooks and RabbitMQ queue drivers like php-amqplib or enqueue/rabbitmq.
- How do I configure RabbitMQ for async processing in Laravel?
- Install a RabbitMQ bridge like vladimir-yuldashev/laravel-queue-rabbitmq, then configure it in `config/queue.php` to use the RabbitMQ connection. Replace Symfony’s `old_sound_rabbit_mq` config with Laravel’s queue driver settings, ensuring exchange/queue names match the bundle’s expectations.
- Does this package support Laravel’s Eloquent lifecycle events (e.g., saved, deleted)?
- No, it’s designed for Symfony’s Doctrine events. For Laravel, map Eloquent events (e.g., `saved`, `deleted`) to RabbitMQ jobs manually in an Observer or EventServiceProvider, then dispatch jobs using Laravel’s queue system or a RabbitMQ bridge.
- What happens if RabbitMQ fails during async processing?
- The bundle doesn’t include retry logic or dead-letter queues. Failed jobs may be lost silently. For Laravel, pair it with a queue driver that supports retries (e.g., Redis or database queues) or implement custom error handling in the consumer callback.
- Is aescarcha/async suitable for CPU-heavy tasks like image processing?
- It’s optimized for I/O-bound tasks (e.g., API calls, database writes) triggered by entity events. For CPU-heavy work, consider Laravel’s process queue driver or a dedicated task queue like Supervisor, as RabbitMQ may not handle long-running processes efficiently.
- How do I handle entity serialization for complex Laravel models (e.g., nested relationships)?
- Use Laravel’s Serializer facade or spatie/laravel-serializable-traits to replace Symfony’s Serializer. Customize serialization logic in the consumer callback to handle nested relationships, circular references, or non-serializable properties explicitly.
- Are there alternatives to aescarcha/async for Laravel async entity processing?
- Yes. For lightweight tasks, use Laravel’s built-in queue system with jobs. For event-driven async, consider spatie/laravel-activitylog or custom Observers dispatching jobs. For RabbitMQ-native solutions, explore enqueue/laravel or vladimir-yuldashev/laravel-queue-rabbitmq directly.
- How do I monitor failed async jobs in production?
- The bundle lacks built-in monitoring. For Laravel, log job failures to a database table or monitoring tool (e.g., Sentry) by catching exceptions in the RabbitMQ consumer callback. Pair with a queue worker supervisor like Supervisor to restart failed consumers.
- Can I use this package without RabbitMQ, or does it strictly require it?
- No, RabbitMQ is mandatory. The bundle relies on `old_sound_rabbit_mq` for message brokering. For Laravel, ensure your RabbitMQ bridge (e.g., vladimir-yuldashev/laravel-queue-rabbitmq) is properly configured, or consider alternatives like Redis or database queues if RabbitMQ isn’t feasible.