From 893bd18d04af4f538dfeb29a2d981971e5e8923c Mon Sep 17 00:00:00 2001 From: David Badura Date: Wed, 10 Jan 2024 11:40:09 +0100 Subject: [PATCH] add throw by error flag in sync projectionist wrapper --- .../Projectionist/SyncProjectionistEventBusWrapper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Projection/Projectionist/SyncProjectionistEventBusWrapper.php b/src/Projection/Projectionist/SyncProjectionistEventBusWrapper.php index 1f89db4fe..2b434ff47 100644 --- a/src/Projection/Projectionist/SyncProjectionistEventBusWrapper.php +++ b/src/Projection/Projectionist/SyncProjectionistEventBusWrapper.php @@ -15,6 +15,7 @@ public function __construct( private readonly EventBus $parentEventBus, private readonly Projectionist $projectionist, private readonly LockFactory $lockFactory, + private readonly bool $throwByError = false, ) { } @@ -29,7 +30,7 @@ public function dispatch(Message ...$messages): void } try { - $this->projectionist->run(); + $this->projectionist->run(throwByError: $this->throwByError); } finally { $lock->release(); } @@ -43,6 +44,7 @@ public static function createWithDefaultLockStrategy(EventBus $parentEventBus, P new LockFactory( new FlockStore(), ), + true, ); } }