Files
kiri-rpc/src/Consumers.php
T

61 lines
973 B
PHP
Raw Normal View History

2021-10-26 18:58:09 +08:00
<?php
namespace Kiri\Rpc;
2021-10-27 19:05:37 +08:00
use Kiri\Kiri;
2021-10-26 18:58:09 +08:00
use Kiri\Pool\Pool;
2021-10-27 19:05:37 +08:00
use SensioLabs\Consul\ServiceFactory;
use SensioLabs\Consul\Services\Agent;
2021-10-26 18:58:09 +08:00
/**
*
*/
class Consumers implements OnRpcConsumerInterface
{
/**
* @var Pool
*/
public Pool $pool;
/**
2021-10-27 19:05:37 +08:00
* @param string $service
2021-10-26 18:58:09 +08:00
* @param string $method
* @param mixed $data
* @param string $version
*/
2021-10-27 19:05:37 +08:00
public function notify(string $service, string $method, mixed $data, string $version = '2.0'): void
2021-10-26 18:58:09 +08:00
{
}
/**
2021-10-27 19:05:37 +08:00
* @param string $service
2021-10-26 18:58:09 +08:00
* @param string $method
* @param mixed $data
* @param string $version
* @param string $id
* @return mixed
*/
2021-10-27 19:05:37 +08:00
public function get(string $service, string $method, mixed $data, string $version = '2.0', string $id = ''): mixed
2021-10-26 18:58:09 +08:00
{
}
2021-10-27 19:05:37 +08:00
private function get_consul($service)
2021-10-26 18:58:09 +08:00
{
2021-10-27 19:05:37 +08:00
$sf = Kiri::getDi()->get(\Kiri\Consul\Agent::class);
2021-10-26 18:58:09 +08:00
2021-10-27 19:05:37 +08:00
$content = $sf->service->service($service)->getBody()->getContents();
2021-10-26 18:58:09 +08:00
2021-10-27 19:05:37 +08:00
$content = json_decode($content, true);
2021-10-26 18:58:09 +08:00
}
}