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

Doctrine Messenger Laravel Package

symfony/doctrine-messenger

Doctrine integration for Symfony Messenger. Store, dispatch, and consume messages using Doctrine-backed transports and tooling. Part of the Symfony ecosystem; issues and contributions go through the main Symfony repository.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. Buy: Buy for Symfony-based applications needing database-backed message transport without external dependencies (e.g., RabbitMQ, Redis). Avoid custom development for this use case, as Symfony’s ecosystem provides battle-tested solutions.
  • Roadmap Prioritization:
    • For Laravel: Invest in native Illuminate\Queue (database/Redis drivers) or third-party Laravel-compatible packages (e.g., spatie/laravel-queue-scheduler). This package is a blocker for Laravel projects.
    • For Symfony: Prioritize adopting Symfony Messenger + Doctrine transport for:
      • Event-driven architectures (e.g., async notifications, batch processing).
      • Microservices communication with persistent message storage.
      • Hybrid cloud/on-prem deployments where external brokers are restricted.
  • Feature Expansion:
    • Enable reliable job retries with Doctrine’s transactional guarantees.
    • Support multi-tenant messaging via Doctrine’s schema customization.
    • Integrate with Symfony’s workflow component for stateful message processing.
  • Tech Debt Reduction:
    • Replace ad-hoc database polling or custom queue tables with a standardized, maintained solution.
    • Align with Symfony’s long-term support (LTS) releases (e.g., Symfony 7.x/8.x).

When to Consider This Package

Adopt this package if:

  • You’re building a Symfony application (not Laravel) and need:
    • A database-backed message transport (e.g., PostgreSQL, MySQL, SQLite).
    • Doctrine ORM integration for message persistence (e.g., storing messages as entities).
    • No external dependencies (e.g., no RabbitMQ, Redis, or AWS SQS).
    • Symfony Messenger features like:
      • Retry logic with exponential backoff.
      • Message bus routing and middleware.
      • Delayed message sending.
  • Your team already uses Symfony Messenger and wants to replace Redis/RabbitMQ with Doctrine for cost or compliance reasons.

Avoid this package if:

  • You’re using Laravel (use Illuminate\Queue or Laravel-compatible packages instead).
  • You need high-throughput messaging (Doctrine transport is not optimized for low-latency, high-volume workloads; consider Symfony’s AMQP transport instead).
  • Your database schema is highly customized (Doctrine transport requires specific table structures).
  • You rely on Symfony Messenger’s legacy features (e.g., doctrine:// transport was deprecated in Symfony 6.4 for newer transports like doctrine://async).
  • Your team lacks Symfony expertise (integration requires familiarity with Symfony’s service container and Messenger component).

Alternatives to Evaluate:

  • For Laravel: spatie/laravel-queue-scheduler, laravel-horizon, or native database/redis drivers.
  • For Symfony: Symfony’s amqp:// or redis:// transports if external brokers are allowed.
  • For Polyglot Persistence: Consider symfony/messenger with a custom transport (e.g., Elasticsearch, MongoDB).

How to Pitch It (Stakeholders)

For Executives: *"This package lets us replace unreliable external message brokers (like RabbitMQ) with a database-native solution, reducing infrastructure costs and improving compliance. By leveraging Symfony’s Messenger component—already used in [X project]—we can:

  • Cut cloud messaging costs by eliminating Redis/RabbitMQ fees.
  • Simplify deployments with no external dependencies.
  • Future-proof our architecture with Symfony’s LTS support. For our Laravel projects, we’ll stick to proven solutions like Laravel Horizon, but for our Symfony stack, this is a low-risk, high-reward upgrade. It aligns with our event-driven roadmap and reduces tech debt by standardizing on Symfony’s ecosystem."*

For Engineering Leaders: *"Symfony Doctrine Messenger Bridge provides a production-ready database transport for Symfony Messenger, ideal for:

  • Async workflows (e.g., order processing, notifications) without external brokers.
  • Multi-tenant isolation via Doctrine’s schema customization.
  • Seamless retries and failures with Doctrine’s transactional integrity. Key trade-offs:
  • Not for Laravel: Forces framework lock-in; use Laravel’s native queue system instead.
  • Performance: Slower than Redis/AMQP for high-throughput workloads (benchmark before adopting).
  • Complexity: Requires Symfony Messenger setup (but pays off for long-term maintainability). Recommendation: Pilot this in [Project Y]’s background job system to replace our custom queue tables. If successful, roll it out to [Project Z] for event sourcing."*

For Developers: *"This package lets us:

  1. Replace doctrine:// transport (deprecated in Symfony 6.4) with a modern, supported solution.
  2. Store messages as Doctrine entities for querying/debugging (e.g., Message::where('status', 'failed')->get()).
  3. Use Symfony’s Messenger middleware (e.g., RetryMiddleware, HandleMessageMiddleware) out of the box. Setup:
composer require symfony/doctrine-messenger
php bin/console messenger:setup-db

Example Use Case:

// Dispatch a message
$bus->dispatch(new SendEmailMessage($user->email, $template));

// Consume messages
php bin/console messenger:consume async --limit=10

Pro Tip: Use queue_name in the DSN to route messages to logical queues (e.g., doctrine://default?queue_name=notifications)."*

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