Skip to content

Commit

Permalink
add log outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura committed Oct 15, 2024
1 parent dd97bb3 commit ca5e10c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Subscription/Engine/DefaultSubscriptionEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ca5e10c

Please sign in to comment.