- Can I use this bundle directly in Laravel, or is it only for Symfony?
- This bundle is built for Symfony Messenger but can be integrated into Laravel via Symfony’s Messenger component. Laravel users can leverage the bundle by installing `symfony/messenger` and configuring the `petitpress/gps-messenger-bundle` transport. Ensure your Laravel app supports Symfony’s Messenger architecture for full compatibility.
- What Laravel versions does this bundle support?
- This bundle doesn’t natively support Laravel versions; it requires Symfony 7.2+ or 8.x. However, Laravel 9+ (which uses Symfony 6+) can integrate it by installing Symfony Messenger and configuring the bundle. Check your Laravel version’s Symfony compatibility to avoid conflicts.
- How do I configure Google Pub/Sub credentials for Laravel?
- Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to your JSON keyfile (e.g., `google-pubsub-credentials.json`). For Laravel, use `.env` files or a service provider to load these credentials. Ensure the Google Cloud SDK PHP library (`google/cloud-pubsub`) is installed via Composer.
- Does this bundle support message retries for failed deliveries?
- Yes, the bundle supports redelivery via the `allowRedelivery` option in configuration. You can also set `max_delivery_attempts` in the `deadLetterPolicy` to control how many times a message is retried before being sent to a dead-letter queue (DLQ). This is useful for transient failures like network issues.
- How do I handle dead-letter messages in production?
- Configure a dead-letter topic in your `deadLetterPolicy` (e.g., `dead_letter_topic: projects/{project}/topics/dlq-topic`). Monitor the DLQ using Google Cloud Logging or custom middleware. For production, consider implementing automated alerts or manual review workflows for failed messages.
- Will this bundle work with Laravel’s queue workers?
- No, this bundle is designed for Symfony Messenger’s workers, not Laravel’s native queue system. However, you can integrate Symfony Messenger into Laravel by publishing Symfony’s Messenger configuration and using its worker commands (`messenger:consume`). Ensure your Laravel app’s queue system is disabled for the relevant transports.
- Are there any breaking changes when upgrading from Symfony 6.4 to 8.x?
- Yes, this bundle drops support for Symfony 5.4/6.4 and requires Symfony 7.2+ or 8.x. Upgrade your Symfony dependencies first, then update the bundle. Check the Symfony Upgrade Guide for migration steps, especially for deprecated features like `setDefault` in transport configurations.
- How do I test message ordering with this bundle?
- Enable message ordering by setting `enableMessageOrdering: true` in your transport configuration. Use the `OrderingKeyStamp` to group related messages under the same ordering key. Test by publishing messages with the same ordering key and verifying they’re processed sequentially in your consumer.
- Can I use this bundle with Laravel’s Horizon for queue monitoring?
- No, Horizon is designed for Laravel’s queue system, not Symfony Messenger. Instead, use Symfony’s built-in monitoring tools or integrate with Google Cloud’s Pub/Sub metrics. For advanced monitoring, consider custom middleware or third-party tools compatible with Symfony Messenger.
- What alternatives exist for Google Pub/Sub in Laravel?
- For Laravel, alternatives include `php-enqueue/gps` (requires Enqueue) or native Laravel queue drivers like Redis or database queues. If you’re using Symfony Messenger, this bundle is the most lightweight option for Pub/Sub. For simpler use cases, consider `symfony/messenger-amqp-transport` if you don’t need Google Cloud-specific features.