改名
This commit is contained in:
+7
-6
@@ -116,21 +116,22 @@ class Producer extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param array|null $config
|
* @param string|null $host
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws ReflectionException
|
|
||||||
* @throws ComponentException
|
* @throws ComponentException
|
||||||
* @throws NotFindClassException
|
* @throws NotFindClassException
|
||||||
|
* @throws ReflectionException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getClient(string $name, array $config = null): Client
|
public function getClient(string $name, string $host = null): Client
|
||||||
{
|
{
|
||||||
$producer = $config ?? $this->producers[$name] ?? null;
|
$producer = $this->producers[$name] ?? null;
|
||||||
if ($producer === null) {
|
if ($producer === null) {
|
||||||
throw new Exception('Unknown rpc client config.');
|
throw new Exception('Unknown rpc client config.');
|
||||||
}
|
}
|
||||||
|
if (!empty($host)) {
|
||||||
if (!isset($producer['host'])) {
|
$producer['host'] = $host;
|
||||||
|
} else if (!isset($producer['host'])) {
|
||||||
$producer['host'] = Snowflake::localhost();
|
$producer['host'] = Snowflake::localhost();
|
||||||
}
|
}
|
||||||
$producerName = $this->getName($name, $producer);
|
$producerName = $this->getName($name, $producer);
|
||||||
|
|||||||
Reference in New Issue
Block a user