基于 swoole 的多进程消息同步微服务 -- (1)需求介绍和系统架构设计

foreach($listShardResponse-> getShardIds() as $shardId)
{
#对每一个 ShardId,先获取 Cursor
$getCursorRequest = new Aliyun_Log_Models_GetCursorRequest($project,$logstore,$shardId,null, time() - 60);
$response = $client -> getCursor($getCursorRequest);
$cursor = $response-> getCursor();
$count = 100;
while(true)
{
#从 cursor 开始读数据
$batchGetDataRequest = new Aliyun_Log_Models_BatchGetLogsRequest($project,$logstore,$shardId,$count,$cursor);
var_dump($batchGetDataRequest);
$response = $client -> batchGetLogs($batchGetDataRequest);
if($cursor == $response -> getNextCursor())
{
break;
}
$logGroupList = $response -> getLogGroupList();
foreach($logGroupList as $logGroup)
{
print ($logGroup->getCategory());
foreach($logGroup -> getLogsArray() as $log)
{
foreach($log -> getContentsArray() as $content)
{
print($content-> getKey().":".$content->getValue()."t");
}
print("n");
}
}
$cursor = $response -> getNextCursor();
}
}
Last updated