diff --git a/Annotation/Rpc/RpcService.php b/Annotation/Rpc/RpcService.php index 0d22b138..d5588dd9 100644 --- a/Annotation/Rpc/RpcService.php +++ b/Annotation/Rpc/RpcService.php @@ -49,14 +49,8 @@ use Snowflake\Snowflake; */ public function execute(array $handler): mixed { - // TODO: Change the autogenerated stub - if ($handler[0] instanceof IProducer) { - $handler[0]->initClient(); - } - $rpc = Snowflake::app()->getRpc(); $rpc->addProducer($this->cmd, $handler, $this->config); - return parent::execute($handler); } diff --git a/Rpc/Producer.php b/Rpc/Producer.php index a89392a2..9b1d2250 100644 --- a/Rpc/Producer.php +++ b/Rpc/Producer.php @@ -42,6 +42,10 @@ class Producer extends Component $this->consumers[$name] = $handler[0]; $this->producers[$name] = $node; + + if ($handler[0] instanceof IProducer) { + $handler[0]->initClient(); + } }