Skip to content

Commit

Permalink
Refactor ConsumerManager to use register() instead of run()
Browse files Browse the repository at this point in the history
This commit refactors the ConsumerManager class in the trigger module. The run() method has been deprecated and will be removed in the next version. It has been replaced with the register() method, which is now used to register consumers. This change improves the clarity and maintainability of the code.

Refactor BindTriggerProcessesListener to use register() instead of run()

This commit refactors the BindTriggerProcessesListener class in the trigger module. The run() method of the ConsumerManager has been replaced with the register() method. This change ensures consistency in the codebase and improves readability.
  • Loading branch information
huangdijia committed Sep 12, 2024
1 parent f6ff5dd commit ce0288c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/ConsumerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
) {
}

public function run()
public function register(): void
{
/** @var array<string,array> */
$connections = $this->config->get('trigger.connections', []);
Expand All @@ -43,6 +43,14 @@ public function run()
}
}

/**
* @deprecated since v3.1, will removed in v3.2
*/
public function run(): void
{
$this->register();
}

protected function createProcess(string $connection, array $options = []): AbstractProcess
{
return new class($this->container, $connection, $options) extends AbstractProcess {
Expand Down
2 changes: 1 addition & 1 deletion src/Listener/BindTriggerProcessesListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public function process(object $event): void
{
$this->subscriberManager->register();
$this->triggerManager->register();
$this->consumerManager->run();
$this->consumerManager->register();
}
}

0 comments on commit ce0288c

Please sign in to comment.