From 530d730edadab4dca090bbc1b7616e002801a85c Mon Sep 17 00:00:00 2001 From: David Badura Date: Mon, 7 Oct 2024 20:59:05 +0200 Subject: [PATCH] add log outputs --- .../Engine/DefaultSubscriptionEngine.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Subscription/Engine/DefaultSubscriptionEngine.php b/src/Subscription/Engine/DefaultSubscriptionEngine.php index 0d0da9617..e4ffbd339 100644 --- a/src/Subscription/Engine/DefaultSubscriptionEngine.php +++ b/src/Subscription/Engine/DefaultSubscriptionEngine.php @@ -816,6 +816,11 @@ private function handleMessage(int $index, Message $message, Subscription $subsc } if ($this->shouldCommitBatch($subscription)) { + $this->logger?->debug(sprintf( + 'Subscription Engine: Subscriber "%s" forces to commit batch.', + $subscription->id(), + )); + $this->ensureCommitBatch($subscription, $index); } @@ -1001,6 +1006,11 @@ private function handleError(Subscription $subscription, Throwable $throwable): unset($this->batching[$subscription->id()]); + $this->logger?->debug(sprintf( + 'Subscription Engine: Subscriber "%s" rollback the batch.', + $subscription->id(), + )); + try { $subscriber->rollbackBatch(); } catch (Throwable $e) { @@ -1022,6 +1032,11 @@ private function ensureCommitBatch(Subscription $subscription, int $index): Erro unset($this->batching[$subscription->id()]); + $this->logger?->debug(sprintf( + 'Subscription Engine: Subscriber "%s" commits the batch.', + $subscription->id(), + )); + try { $subscriber->commitBatch(); $subscription->changePosition($index); @@ -1064,6 +1079,11 @@ private function checkAndBeginBatch(Subscription $subscription): Error|null $this->batching[$subscription->id()] = $realSubscriber; + $this->logger?->debug(sprintf( + 'Subscription Engine: Subscriber "%s" starts a new batch.', + $subscription->id(), + )); + try { $realSubscriber->beginBatch(); } catch (Throwable $e) {