From 8c95c9cf7473c76b8bb9dc0f26d2c4dd4840bd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 17 May 2021 17:18:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kafka/Producer.php | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/Kafka/Producer.php b/Kafka/Producer.php index 0378dd6e..fe7ba48f 100644 --- a/Kafka/Producer.php +++ b/Kafka/Producer.php @@ -29,8 +29,6 @@ use Snowflake\Snowflake; class Producer extends Component { - private string $_topic = ''; - private Conf $conf; private TopicConf $topicConf; @@ -80,17 +78,6 @@ class Producer extends Component } - /** - * @param $servers - * @return Producer - */ - public function setTopic(string $servers): static - { - $this->_topic = $servers; - return $this; - } - - /** * @param string $topic * @param array $params @@ -131,12 +118,14 @@ class Producer extends Component } - /** - * @param string $toPic - * @param string|null $key - * @param array $data - * @param string|null $groupId - */ + /** + * @param string $toPic + * @param string|null $key + * @param array $data + * @param string|null $groupId + * @throws ConfigException + * @throws Exception + */ public function batch(string $toPic, ?string $key, array $data, ?string $groupId = null) { $this->beforePushMessage($toPic, $groupId); @@ -167,7 +156,6 @@ class Producer extends Component } $this->setGroupId($consumers['groupId']); $this->setBrokers($consumers['brokers']); - $this->setTopic($topic); }