Skip to content

Commit

Permalink
Merge pull request #15 from xiaocaigua/4.x.1
Browse files Browse the repository at this point in the history
4.x.1
  • Loading branch information
kiss291323003 authored Jul 17, 2019
2 parents 8db72fe + 95546eb commit 0f23adf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@
新的连接。那么此时就要求客户端不再对其发起请求。因此EasySwoole RPC提供了NodeManager接口,你可以以任何的形式来
监控你的服务提供者,在getServiceNode方法中,返回对应的服务器节点信息即可。

<<<<<<< HEAD
###EasySwoole RPC执行流程

服务端:
注册RPC服务,创建相应的服务swoole table表(ps:记录调用成功和失败的次数)
注册worker,tick进程

woker进程监听:
客户端发送请求->解包成相对应的格式->执行对应的服务->返回结果->客户端

tick进程:
注册定时器发送心跳包到本节点管理器
启用广播:每隔几秒发送本节点各个服务信息到其他节点
启用监听:监听其他节点发送的信息,发送相对应的命令(心跳|下线)到节点管理器处理
进程关闭:主动删除本节点的信息,发送下线广播到其他节点

![](easyswoole-rpc.png)

## Composer安装
```
Expand Down
Binary file added easyswoole-rpc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/TickProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ protected function onShutDown()
/** @var Config $config */
$config = $this->getConfig()->getArg()['config'];
$serviceList = $this->getConfig()->getArg()['serviceList'];
foreach ($serviceList as $service) {//遍历本节点的服务列表
try {
$node = new ServiceNode();
$node->setServiceVersion($service->version());
$node->setServiceName($service->serviceName());
$node->setNodeId($config->getNodeId());
$config->getNodeManager()->deleteServiceNode($node);
} catch (\Throwable $throwable) {
$this->onException($throwable);
}
}
$this->udpBroadcast($config, $serviceList, BroadcastCommand::COMMAND_OFF_LINE);
}

Expand Down

0 comments on commit 0f23adf

Please sign in to comment.