PHPackages                             velpl/symfony-messenger-outbox-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. velpl/symfony-messenger-outbox-bundle

ActiveSymfony-bundle

velpl/symfony-messenger-outbox-bundle
=====================================

Outbox pattern using Symfony Messenger

0.1.0(1mo ago)00MITPHPPHP ^8.4 | ^8.5CI passing

Since Jul 14Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/velPL/symfony-messenger-outbox-bundle)[ Packagist](https://packagist.org/packages/velpl/symfony-messenger-outbox-bundle)[ RSS](/packages/velpl-symfony-messenger-outbox-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (12)Versions (2)Used By (0)

A transactional outbox pattern implementation for Symfony framework using Doctrine ORM and Messenger component
==============================================================================================================

[](#a-transactional-outbox-pattern-implementation-for-symfony-framework-using-doctrine-orm-and-messenger-component)

This Symfony bundle streamlines configuration of messenger transports and messages dispatching using the transactional outbox pattern. The benefit of using it is that you will be able to create a transaction which saves all your unit of work on entities into the database and dispatch a messenger event or command. Either both succeed or none – you always end up in a consistent state.

Requirements
------------

[](#requirements)

- **PHP:** 8.4 or 8.5
- **Symfony:** 7.4 LTS or 8.1

Installation
------------

[](#installation)

> ⚠️ Please mind this is a work in progress and not yet a stable release – breaking changes are possible. Please provide feedback, suggestions and bug reports using GitHub issues. Pull requests are very welcome!

Install the bundle using Composer:

```
composer require velpl/symfony-messenger-outbox-bundle:^0.1
```

Configuration and usage
-----------------------

[](#configuration-and-usage)

1. Configure messenger buses that you want to use with the outbox pattern with the middleware provided by this bundle:

```
framework:
    messenger:
        buses:
            command.bus:
                middleware:
                  # - ...............
                    - 'Velpl\SymfonyMessengerOutboxBundle\Messenger\Outbox\Middleware\OutboxPatternMiddleware'
                  # - ...............
```

2. Configure the outbox pattern in the bundle configuration (be sure to pass the same connection name as your entity manager uses so that transaction actually can be performed):

```
# ............
        transports:
            outbox: 'doctrine://default?queue_name=outbox'
```

3. Create a message you want to dispatch and add an attribute pointing to the actual transport name that should handle it:

```
