改名
This commit is contained in:
+5
-4
@@ -92,9 +92,7 @@ class Producer extends Component
|
|||||||
* @param string $topic
|
* @param string $topic
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @param string|null $groupId
|
* @param string|null $groupId
|
||||||
* @throws NotFindClassException
|
* @throws Exception
|
||||||
* @throws ReflectionException
|
|
||||||
* @throws ConfigException
|
|
||||||
*/
|
*/
|
||||||
public function dispatch(string $topic, array $params = [], string $groupId = null)
|
public function dispatch(string $topic, array $params = [], string $groupId = null)
|
||||||
{
|
{
|
||||||
@@ -102,13 +100,16 @@ class Producer extends Component
|
|||||||
if (empty($consumers) || !is_array($consumers)) {
|
if (empty($consumers) || !is_array($consumers)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!isset($consumers['brokers'])) {
|
||||||
|
throw new Exception('You need set brokers config.');
|
||||||
|
}
|
||||||
if (!empty($groupId)) {
|
if (!empty($groupId)) {
|
||||||
$consumers['groupId'] = $groupId;
|
$consumers['groupId'] = $groupId;
|
||||||
} else if (!isset($consumers['groupId'])) {
|
} else if (!isset($consumers['groupId'])) {
|
||||||
$consumers['groupId'] = $topic . ':' . Snowflake::localhost();
|
$consumers['groupId'] = $topic . ':' . Snowflake::localhost();
|
||||||
}
|
}
|
||||||
$this->setGroupId($groupId)->setTopic($topic)
|
$this->setGroupId($groupId)->setTopic($topic)
|
||||||
|
->setBrokers($consumers['brokers'])
|
||||||
->delivery(swoole_serialize($params));
|
->delivery(swoole_serialize($params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user