Message Outbox for Illuminate

Published at 24 August 2021

Packagist Version

composer require eventsauce/message-outbox-for-illuminate
use EventSauce\MessageOutbox\IlluminateOutbox\IlluminateOutboxRepository;
use EventSauce\MessageOutbox\OutboxMessageDispatcher;

$outboxRepository = new IlluminateOutboxRepository($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\IlluminateOutbox\IlluminateTransactionalMessageRepository;

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

EventSauce is a project by Frank de Jonge.