diff --git a/CHANGELOG.md b/CHANGELOG.md index 097373d..c72dfd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * chore: static analysis fix * fix: change outbox primary key to bigint * feat: also listen to `WorkerMessageHandledEvent` for relaying messages +* feat: CLI relay all messages, not just the first 100 ## 2.5.0 diff --git a/packages/domain-event-outbox/src/Command/MessageRelayCommand.php b/packages/domain-event-outbox/src/Command/MessageRelayCommand.php index d325eb9..6809bd8 100644 --- a/packages/domain-event-outbox/src/Command/MessageRelayCommand.php +++ b/packages/domain-event-outbox/src/Command/MessageRelayCommand.php @@ -67,7 +67,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw new \InvalidArgumentException('The manager name must be a string.'); } - $this->messageRelay->relayMessages($managerName); + do { + $messagesRelayed = $this->messageRelay->relayMessages($managerName); + } while ($messagesRelayed > 0); return Command::SUCCESS; } diff --git a/packages/domain-event-outbox/src/MessageRelay/MessageRelayAll.php b/packages/domain-event-outbox/src/MessageRelay/MessageRelayAll.php index 7c50c21..4e4a811 100644 --- a/packages/domain-event-outbox/src/MessageRelay/MessageRelayAll.php +++ b/packages/domain-event-outbox/src/MessageRelay/MessageRelayAll.php @@ -31,7 +31,9 @@ public function relayAll(): void $managerNames = $this->managerRegistry->getManagerNames(); foreach ($managerNames as $managerName => $serviceId) { - $this->messageRelay->relayMessages($managerName); + do { + $messagesRelayed = $this->messageRelay->relayMessages($managerName); + } while ($messagesRelayed > 0); } } }