Extended message outbox components for EventSauce
composer require andreo/eventsauce-outbox
- PHP >=8.2
- Symfony console ^6.2
use Andreo\EventSauce\Outbox\Repository\EventSourcedAggregateRootRepositoryForOutbox;
new EventSourcedAggregateRootRepositoryForOutbox(
aggregateRootClassName: $aggregateRootClassName,
messageRepository: $messageRepository, // EventSauce\EventSourcing\MessageRepository
regularRepository: $regularRepository // EventSauce\EventSourcing\AggregateRootRepository
)
This consumer dispatch messages through the message dispatcher to the queuing system
use Andreo\EventSauce\Outbox\MessageConsumer\ForwardingMessageConsumer;
new ForwardingMessageConsumer(
messageDispatcher: $messageDispatcher // EventSauce\EventSourcing\MessageDispatcher
)
use Andreo\EventSauce\Outbox\Command\OutboxMessagesConsumeCommand;
new OutboxMessagesConsumeCommand(
relays: $relays, // Symfony\Component\DependencyInjection\ServiceLocator<EventSauce\MessageOutbox\OutboxRelay>
logger: $logger, // ?Psr\Log\LoggerInterface
)
php bin/console andreo:eventsauce:message-outbox:consume foo-relay-id
relays
- required
- string[]
Relay ids registered in service locator
--run=true
- optional
- default: true
Processing messages run
--batch-size=100
How many messages are to be retrieve batch
- optional
- default: 100
--commit-size=1
How many messages are to be committed at once
- optional
- default: 1
--sleep=1
Number of seconds to sleep if the repository is empty
- optional
- default: 1
--limit=-1
How many times messages are to be processed
- optional
- default: -1 (infinity)