andreo / eventsauce-outbox
Extended message outbox components for EventSauce.
3.3
2023-03-17 11:41 UTC
Requires
- php: >=8.2
- eventsauce/eventsauce: ^3.0
- eventsauce/message-outbox-for-doctrine: ^0.3.0
- eventsauce/test-utilities: ^3.0
- symfony/console: ^6.2
- symfony/dependency-injection: ^6.2
Requires (Dev)
- eventsauce/uuid-encoding: ^0.3
- phpstan/phpstan: ^1.3
- phpunit/phpunit: ^9.4
- roave/security-advisories: dev-latest
README
Extended message outbox components for EventSauce
composer require andreo/eventsauce-outbox
Requirements
- PHP >=8.2
- Symfony console ^6.2
Previous version docs
Repository without message dispatching
use Andreo\EventSauce\Outbox\Repository\EventSourcedAggregateRootRepositoryForOutbox; new EventSourcedAggregateRootRepositoryForOutbox( aggregateRootClassName: $aggregateRootClassName, messageRepository: $messageRepository, // EventSauce\EventSourcing\MessageRepository regularRepository: $regularRepository // EventSauce\EventSourcing\AggregateRootRepository )
Forwarding message consumer
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 )
Command to dispatching messages from the outbox
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
Command options
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)