-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Boot trigger processes on main worker start (#331)
* Boot trigger processes on main worker start * Rename listener * Revert "Rename listener" This reverts commit 3f8653a992d0d814baf0677f500ee88f5d3bacff. * Rename * Remove listener from ConfigProvider --------- Co-authored-by: Deeka Wong <[email protected]>
- Loading branch information
1 parent
781326f
commit ce853ad
Showing
3 changed files
with
52 additions
and
31 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,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of friendsofhyperf/components. | ||
* | ||
* @link https://github.com/friendsofhyperf/components | ||
* @document https://github.com/friendsofhyperf/components/blob/main/README.md | ||
* @contact [email protected] | ||
*/ | ||
|
||
namespace FriendsOfHyperf\Trigger\Listener; | ||
|
||
use FriendsOfHyperf\Trigger\ConsumerManager; | ||
use FriendsOfHyperf\Trigger\SubscriberManager; | ||
use FriendsOfHyperf\Trigger\TriggerManager; | ||
use Hyperf\Event\Contract\ListenerInterface; | ||
use Hyperf\Framework\Event\MainWorkerStart; | ||
use Hyperf\Server\Event\MainCoroutineServerStart; | ||
|
||
class BindTriggerProcessesListener implements ListenerInterface | ||
{ | ||
public function __construct( | ||
protected SubscriberManager $subscriberManager, | ||
protected TriggerManager $triggerManager, | ||
protected ConsumerManager $consumerManager | ||
) { | ||
} | ||
|
||
public function listen(): array | ||
{ | ||
return [ | ||
MainWorkerStart::class, | ||
MainCoroutineServerStart::class, | ||
]; | ||
} | ||
|
||
/** | ||
* @param MainWorkerStart|MainCoroutineServerStart $event | ||
*/ | ||
public function process(object $event): void | ||
{ | ||
$this->subscriberManager->register(); | ||
$this->triggerManager->register(); | ||
$this->consumerManager->run(); | ||
} | ||
} |
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