Download the PHP package velpl/symfony-messenger-outbox-bundle without Composer
On this page you can find all versions of the php package velpl/symfony-messenger-outbox-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download velpl/symfony-messenger-outbox-bundle
More information about velpl/symfony-messenger-outbox-bundle
Files in velpl/symfony-messenger-outbox-bundle
Package symfony-messenger-outbox-bundle
Short Description Outbox pattern using Symfony Messenger
License MIT
Informations about the package symfony-messenger-outbox-bundle
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
- PHP: 8.4 or 8.5
- Symfony: 7.4 LTS or 8.1
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:
Configuration and usage
-
Configure messenger buses that you want to use with the outbox pattern with the middleware provided by this bundle:
-
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):
- Create a message you want to dispatch and add an attribute pointing to the actual transport name that should handle it:
You don't need to add messages with AsOutboxTransport to the messenger.yaml routing section
-
Use entity manager to wrap your unit of work and dispatch the message in transaction:
-
Create actual handler for the
CreateTodoCommandmessage and wire it to thecommand.buswithAsMessageHandler(bus: 'command.bus')attriute - Consume the outbox transport – it will read
AsOutboxTransporton outbox message and re-dispatch it to the appropriate transport (async_todo_creationin this example - you can then consume it from there using Doctrine or any other transport like RabbitMQ):
License
MIT
All versions of symfony-messenger-outbox-bundle with dependencies
symfony/messenger Version ^7.4 | ^8.1
symfony/framework-bundle Version ^7.4 | ^8.1