-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add trigger subscription engine event bus
- Loading branch information
1 parent
7642156
commit ff33b07
Showing
10 changed files
with
421 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\EventBus; | ||
|
||
use Patchlevel\EventSourcing\Message\Message; | ||
|
||
use function array_values; | ||
|
||
final class ChainEventBus implements EventBus | ||
{ | ||
/** @var list<EventBus> */ | ||
private readonly array $eventBus; | ||
|
||
public function __construct( | ||
EventBus ...$eventBus, | ||
) { | ||
$this->eventBus = array_values($eventBus); | ||
} | ||
|
||
public function dispatch(Message ...$messages): void | ||
{ | ||
foreach ($this->eventBus as $eventBus) { | ||
$eventBus->dispatch(...$messages); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\Subscription\Engine; | ||
|
||
use RuntimeException; | ||
|
||
final class AlreadyProcessing extends RuntimeException | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct('Subscription engine is already processing'); | ||
} | ||
} |
Oops, something went wrong.