Message Outbox for Doctrine 2

Packagist Version

composer require eventsauce/message-outbox-for-doctrine-v2
use EventSauce\MessageOutbox\DoctrineV2Outbox\DoctrineOutboxRepository;
use EventSauce\MessageOutbox\OutboxMessageDispatcher;

$outboxRepository = new DoctrineOutboxRepository($connection, $tableName, $messageSerializer);
$messageDispatcher = new OutboxMessageDispatcher($outboxRepository);

To ensure dispatching and persisting of messages is done in a single transaction, use the transactional repository wrapper:

use EventSauce\MessageOutbox\DoctrineV2Outbox\DoctrineTransactionalMessageRepository;

$messageRepository = new DoctrineTransactionalMessageRepository(
    $connection,
    $innerMessageRepository, // based which uses the same db connection,
    $messageSerializer,
);
Frank de Jonge

EventSauce is a project by Frank de Jonge.