一:队列配置队列的配置文件放置在config/queue.php文件中,laravel框架中支持的队列驱动有:sync, database, beanstalkd, sqs, redis,null对应
顺晟科技
2022-10-19 10:23:10
152
问题一:
webman监听MNS消息队列,无法实时消费,每次消费中间间隔不定的时间
数据库的执行几乎不耗费时间,不是数据库等待时间
请问还可以从哪些方面去找问题
问题二:
报这个错误 worker[task:2630] exit with status 9
首先开自定义进程
public function onWorkerStart()
{
$endPoint = '1';
$accessId = "2";
$accessKey = "3";
//队列名称
$queueName = "buyorder-settle";
$client = new Client($endPoint, $accessId, $accessKey);
$queue = $client->getQueueRef($queueName);
pcntl_signal(SIGINT, function () {
Worker::stopAll();
});
while (true) {
try {
$t1_start=time();
$res = $queue->receiveMessage(1);
$receiptHandle = $res->getReceiptHandle();
//接收消息
$r = $res->getMessageBody();
$update_o = [
'buyorder_status' => "finish",
];
$r1 = Db::name("buy_order")
->where("buyorder_id", $r['order_id'])->update($update_o);
if ($r1) {
$delete_action = $queue->deleteMessage($receiptHandle);
$haoshi=time()-$t1_start;
print(date('Y-m-d H:i:s')."---完成--耗时".$haoshi."s"."\r\n");
pcntl_signal_dispatch();
}
} catch (\Throwable $throwable) {
}
}
}
MNS应该如何填写参数
26
2023-02
02
2022-11
19
2022-10
15
2022-09
15
2022-09
06
2021-07